Adding a While step

You can insert the While logic in a test to make a set of steps run in a loop only if a specific condition is met.

Before you begin

You must have completed the following tasks:
  • Ensured that you are assigned a Team Space Owner, Project Owner, or Member with a Tester role to create or edit a test resource.
  • Read and understood the information in Edit branch overview and Create or select an Edit branch.
  • Ensured that your project contains a Web UI test.

Procedure

  1. Click the Edit button displayed on the Test Editor page.

    The Edit button appears only when no active edit branch is selected.

    Alternatively, right-click the test in the test navigator panel and select Edit.

    The Edit branch dialog is displayed.
    If the Edit branch dialog is not displayed, then go to step 3.
  2. Select an existing edit branch or create a new edit branch.
  3. Drag and drop the While element under any test step as required from the Flow catalog in the Catalog tab.
  4. Click the While step.
    The step details pane is displayed.
  5. Perform the following steps in the step details pane:
    1. Select a variable in the Value 1 list.
    2. In the Operator field, indicate the basis of comparison of the two operands. Note that the two operands are strings.
      The available operators are as follows:
      • Equals
      • Greater Than
      • Greater Than Equals
      • Equals variable
      • Less Than
      • Less Than Equals
      • Strict Equals
    3. Enter a value to be compared with the value of the selected variable in the Value 2 list.

      Alternatively, you can select the Code checkbox to enter the While statement in the text box.

    4. Select the Negate the operator checkbox to negate a condition when you perform a comparison.

      For example, if the result of any condition is true, the result returns false.

  6. Click the Save icon to save the modifications.

Results

You have added a While step that checks whether a specific condition is met in the test from the Flow catalog.

What to do next

You can run the test and view the results. See Running a Web UI test.