Description
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.
Using the Operation
Position
Number of occurrences: | Unlimited. |
Parent operations: | Any other operation. If the scenario editor displays pages and connections, the operations cannot be placed between a page and a connection. |
Child operations: | The operation has two children: Then and Else (see above). |
Operation Think Time
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.
Operation SLA
The SLA edit box at the top of the editor specifies the maximum acceptable duration of the operation, in milliseconds.
Operation Properties
Condition Page
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:
To check if a variable exists, use a condition like @VarName "Variable exists" True
:
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
-
Click a cell.
-
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.
-
-
Select the needed comparison operation from the Operation drop-down list.
-
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
-
Select either AND, or OR on the toolbar, and
-
Move the pointer to specify the new group’s location.
-
Drag existing conditions to the group, or add new conditions to it.
To delete a condition
-
Select the condition, and
-
Press Del or click on the editor toolbar.
Summary Page
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.
Information on Errors and Warnings
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