While...Loop

Walk--through of Do...While 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 10.

4.  Click Generate.

Random

5.  Enable hover over highlighting and hover over the Result box.

6.  Click Build Step.

Build Verification

7.  Choose Content under Verifications in the Step Builder.

  • Set the first drop-down to InnerText.
  • Set the second drop-down to NotContain.
  • Click Add Step.

Content

8.  Disable hover over highlighting and minimize the browser.

9.1  In version 2015 R1 choose Conditions in the Step Builder and add while...loop step.

Standalone
Standalone version
VS Plugin
VS Plugin

9.2  In version 2014 R4 and earlier click the Logical button in the Add ribbon. Choose while...loop.

Standalone
Standalone version
VS Plugin
VS Plugin

10.  Choose the verification we've already added from the dropdown of the While step.

Choose Verification

11.  Uncheck/Delete the verification step so it will not be executed (We have this verification already added in the while step)

Uncheck Verification

12.  Drag the Click Generate Button step into the WHILE step.

Drag into While Step

13.  Add an Execution Delay step from the More drop-down in the Add ribbon. Set it to 20 milliseconds.

14.  Drag the Execution Delay step into the WHILE step.

Drag Execution Step

15.  Click Save and Execute. The test will continue to generate a random number between 1 and 10 until it generates the number referenced in the Verify step (4 in this example).