Walk--through of the IF...Else Statement process.

1.  Create a Web Test and click Record.

2.  Navigate to www.random.org.

3.  Set the Min field to 1 and the Max field to 2.

4.  Click Generate.


5.  Enable hover over highlighting by clicking Highlight Element in the Test Studio Recorder and hover over the Result box.

Enable Highlighting

6.  Click Quick Tasks and double click Verify - text contains '1'.


7.  Disable hover over highlighting and minimize the browser.

8.1  In version 2015 R1 choose Conditions in the Step Builder and add if...else step.

Standalone version
VS Plugin
VS Plugin

8.2  In version 2014 R4 and earlier click the Logical button in the Add ribbon and choose if...else.

Standalone version
VS Plugin
VS Plugin

9.  From the drop down in the IF step select the previously recorded verification.

Choose Verification

10.  Uncheck/Delete the verification outside the IF step, so it will not be executed (We have this verification already added in the IF step)

Uncheck Verification

11.  Bring up the IE recording window and navigate to www.google.com. Minimize the browser again.

12.  Drag the Navigate to Google step into the IF step.

Drag in IF Step

13.&nbsp Bring up the IE recording window and navigate to www.bing.com. Minimize the browser again.

14.&nbsp Drag the Navigate to Bing step into the ELSE step.

Drag in ELSE Step

15.  Save and Execute the test.

  • If 1 is generated it navigates to Google.

Navigate to Google

  • If 2 is generated it navigates to Bing.

Navigate to Bing


  • Test steps in an if branch are skipped when an If condition was evaluated as false (for example, the target TextBox element contains the wrong content). Likewise, steps in an else branch are skipped when the if condition is evaluated as true. Steps skipped for this reason show a 'not-run' icon.

  • However, if the condition of an if branch cannot be evaluated (for example, the target element for a TextContent verification cannot be located), the steps in the if branch will be skipped, and will display a 'not-run' icon.