While...Loop

You can also review our Telerik TV episode on the Do...While Statement for a video walk-through of this 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.
  5.  

     

  6. Enable hover over highlighting and hover over the Result box. Click the blue nub.
  7. Click Build Verification.
  8.  

     

  9. Click the Content button under Available Verifications.
    1. Set the first drop-down to InnerText.
    2. Set the second drop-down to NotContain.
    3. Click OK.

     

     

  10. Test Studio recognizes you are verifying the number is not 4, when indeed it is 4. Click Yes to continue.
  11.  

     

  12. Disable hover over highlighting and minimize the browser.
  13. Click the Logical button in the Add ribbon. Choose while...loop.
  14.  

    Standalone version

    VS plugin

     

  15. Hover over the WHILE step and click the green plus icon.
  16.  

     

  17. Click the green plus icon that appears next to the Verify step to associate it with the WHILE statement.
  18.  

     

  19. Drag the Click Generate Button step into the WHILE step.
  20.  

     

  21. Add an Execution Delay step from the More drop-down in the Add ribbon. Set it to 15 milliseconds.
  22.  

    Standalone version

    VS plugin

     

  23. Drag the Execution Delay step into the WHILE step.
  24.  

     

  25. 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).