"IF" Command

Description: This command is used to add an If statement under which another step(s) will be executed based on the result of comparison.

Usage Scenario: Suppose we want to see if the value in Country text box on our Reference app is blank or not and if it is blank, we want to fill it with a value.

Procedure: Use Get_Web_Value command to retrieve the current value in Country text box. Add a step with If command and in the Left Value, enter the variable name preceded by @. Leave the Right Value blank. The operator needs to be “Equal” which means our next step will perform only if the value in Country text box is blank. Your next step is to use a Fill command with value “USA”. The remaining Print steps will execute depending on which condition is met. Your steps will look like this:

See the Test Library path: subject7_samples/subject7_advanced_suite/subject7_modify_profile_information

The following video demonstrates how “Country” text box is checked and filled depending on the condition as part of execution of “subject7_modify_profile_information” test case in “subject7_samples” folder: