Insert conditional statements
You can insert conditional statements to verify the values of the variables in the script and perform actions in the application.
Before you beginAll variables to be tested while running conditional statements must be captured during the script recording. To do this, use the Get a Specific Property Value feature that is available in the verification point wizard while recording the script to assign a control property to a variable in the script.
To insert conditional statements:
- Select the test line in the script editor.
- Right-click and select Insert Condition (If Clause) (). An If Then clause is inserted in the script editor. The selected test line is inserted in the Then group.
- Select the If clause.
- In the Properties-General view, specify the variable values that must be verified.
- Select the variable that must be verified in the Left Side field. The Left Side field lists all the variables that are declared during the script recording before the selected test line.
- Select the required parameter in the Compares To field.
- Type the variable value in the Right Side field. For string values, specify the value using quotation marks, for example, "Visa". You can also select another variable from the list if the first operand must be verified against another variable.
- Optional: To run other test lines that must also run if the variable conditions are met, select and drag the test lines into the Then group.
- You can insert the Else clause for the test lines that must be run if the variable conditions are not met. Select the If or Then clause, or any test lines in the Then group, right-click and select Insert Else Clause (). Select and drag the test lines that must be executed if the variable conditions are not met into the Else group.
- Click File > Save to save the script. During script playback, the variable conditions are checked and the required test lines are run.
Get a property value
Properties view - General page