Call an Action that resides in the same script

Use the RunAction method

RunAction ActionName, [ Iteration , Parameters]

ActionName The name of the Action.
Iteration (Optional) The number of iterations to run the action. The parameter accepts the following values:

  • oneIteration or (Default)-Runs the action only once, using the row in the action’s data sheet that corresponds to the global data sheet iteration counter.
    If the action’s data sheet contains fewer rows than the global sheet, the last row of the action’s data sheet will be used for each subsequent iteration.
  • allIterations or 1-Runs iterations on all rows.
  • iteration row range (for example, "1-7")-Indicates the rows for which action iterations will be performed. Note: Iteration is required when calling an external action, but optional when calling a local action (from within the test).
Parameters (Optional) The values and storage locations for the called action’s input and output parameters. Input parameters are listed before output parameters.
For an input parameter, specify either a fixed value or the name of another defined parameter (Data Table parameter, environment parameter, or an action input parameter of the calling action) from which the argument should take its value.
For an output parameter, specify either a variable in which you want to store the value or the name of a defined parameter (Data Table parameter, environment parameter, or an action output parameter of the calling action).

If the Action called by the RunAction statement includes an ExitAction statement, the RunAction statement can return the value of the ExitAction’s RetVal argument.

To call Action1 from Action2, you would use the following code in Action2:

READ  Text on small objects or in a small text area is not captured or is captured incorrectly

RunAction "Action1"

The following example calls the SearchFlight action, and runs all iterations of the Action.

RunAction "SearchFlight", allIterations

The following example performs the same call as the previous example, but runs only one iteration of the Action and saves the returned value to the AxnVal variable.

AxnVal=RunAction ("SearchFlight", oneIteration)

The following example runs the SearchFlight actions for two iterations, using the data in rows 2 and 3 of the local sheet.

RunAction "SearchFlight", "2 – 3"

The following example runs one iteration of the action, supplies a string value of MyValue for the input parameter, and stores the resulting value of the output parameter in a variable called MyVariable.

RunAction "Action2", oneIteration, "MyValue", MyVariable

Leave a Comment