Use the If... Then operation to check conditions in your keyword tests and execute operations according to the result of the check. The operation checks the condition, which is specified by operation parameters, and if the condition evaluates to True, the operation executes child operations.
The operations that should be run if the condition evaluates to False, place the Else operation directly after If... Then. TestComplete will detect the If... Then... Else block and if the condition is False, will switch the execution flow to the Else operation.
The operation returns True or False to indicate the result of the specified condition.
The operation is analogue to the
if statements in program languages like C++, Visual Basic or Delphi.
The operation can have any number of any operations as children.
If you use the Else operation along with If... Then, place this Else operation after If... Then and at the same level.
For information on how to make an operation a child of another operation, see the description of the Keyword Test editor’s Test Steps page.
The operation has only one parameter: the condition to be checked. You specify this condition in the Operation Parameters dialog:
The condition may contain one or several comparison expressions. In the last case, the expressions are combined with each other with the AND and OR operators.
Each row in the dialog corresponds to a comparison expression. The expression has two operands (Value 1 and Value 2) and the comparison operator between them. To specify the operator, simply select the desired value from the drop-down list of the Condition column.
To specify the values (operands), use the columns under the Value 1 and Value 2 bands. Each value can be specified in one of the following modes:
The values are specified in the same manner, in which you specify operation parameters. See Specifying Operation Parameters for detailed information.
All the expressions that make up the condition are combined with each other with the AND or OR operators. To add a new expression to the condition:
Select the expression, with which a new expression will be combined.
Click And or Or to specify the desired operator. The row for the new expression will be displayed in the Operation Parameters dialog.
Specify the expression’s values and condition.
Select the desired expression in the dialog.
To delete all the expressions, press Clear.