Decision logic evaluates a user-defined condition, and then runs a sequence of test steps depending on the return value of the condition. The condition used in decision logic compares two values and returns a value based on the comparison. For more information, see Condition Designer. The values in the condition can be the value of a property of a control in the test application, the value of a variable used in the visual test, or a literal value. For more information, see Test Logic Designer: Select a Logic Type (Decision).
Decision logic consists of the following elements:
If <condition=TRUE> Then __<Run sequence of test steps> End If
For example, the condition in the following decision logic compares the variable propertyVar with the literal value "4". If the variable propertyVar is greater than the literal value "4", then steps 5 through 9 are run:
If propertyVar > 4 Then __Do Step 5 To Step 9 End If
Additionally, you can create more complex decision logic that can be nested to as many levels as you need by using Else IF and Else.
If <condition=TRUE> Then __<Run sequence of test steps> Else If <condition=TRUE> Then __<Run sequence of test steps> Else __<Run sequence of test steps> End If
For example, the condition in the following decision logic compares the variable propertyVar with the literal value "4". If the variable propertyVar is greater than the literal value "4", then steps 5 through 9 are run. If it is less than "4", then steps 10 through 14 are run. If it is equal to "4", then step 15 is run:
If propertyVar > 4 Then __Run Step 5 to Step 9 Else If propertyVar < 4 Then __Run Step 10 to Step 14 Else __Run Step 15 End If
You can create decision logic using either the Test Logic Designer wizard, the Logic Toolbox , or by using If...Else If...Else test steps.