Applies to LoadComplete 4.97, last modified on May 20, 2019

Use the If operation to add conditional execution to your scenarios. For example, you can check if a variable contains a specific value and execute certain operations in this case. You can create complex conditions that include several checks grouped with the AND and OR operators.

The If operation has two child nodes: Then and Else. Operations that you put under the Then node run when the If condition evaluates to True; operations under the Else node run when the If condition evaluates to False. If you do not need either Then, or Else block, simply leave it empty.

The Think Time edit box at the top of the scenario editor specifies the number of milliseconds the operation will wait before it starts executing.

The Then and Else blocks also have the Think Time edit boxes at the top. They specify the delay before the block execution. This is an extra think time in addition to the If operation’s think time.

The SLA edit box at the top of the editor specifies the maximum acceptable duration of the operation, in milliseconds.

On the Condition page, you specify the condition to be evaluated. You can gather several simple conditions into a complex group with the AND or OR operator.

To add a new condition

Follow the steps specified in the image:

Adding condition

To check if a variable exists, use a condition like @VarName "Variable exists" True:

Checking if a variable exists

Similarly, to check if a variable does not exist, use a condition like @VarName "Variable exists" False.

True and False can have both upper-case and lower-case characters. Instead of the True and False values, you can specify a variable that contains the True or False string (case-insensitive).

To edit a condition
  1. Click a cell.

  2. Type the desired value or select it from the drop-down list or a helper dialog.

    Notes:

    • Specify variables in the format @variable_name.

    • Do not enclose values in quotes.

    • All values are treated as strings.

  3. Select the needed comparison operation from the Operation drop-down list.

  4. Press Enter to confirm the change.

To move a condition
  • Simply drag it to the desired place in the Condition page.

To create AND or OR condition groups
  1. Select either AND, or OR on the toolbar, and

  2. Move the pointer to specify the new group’s location.

  3. Drag existing conditions to the group, or add new conditions to it.

To delete a condition
  1. Select the condition, and

  2. Press Del or click on the editor toolbar.

This page provides summary information on the operation and its child operations like the number of found errors, the list of variables used, and so on. Information on the page is read-only.

You can find information on issues in operation properties in the Summary page. Also, information about the erroneous settings is displayed in the editor’s header area.

See Also

Operation Reference
Stop Operation
While Operation
Loop Operation
Stopping Tests on Errors
Editing Scenarios

Highlight search results