Adding conditional logic and redefining the flow in tests from the Flow catalog

When you want to add conditional logic and redefine the flow to update a test, you can add such steps from the Flow catalog. You can add a test inside the test as a step and abort the test after marking it as failed. Also, you can insert the If, While, and Do-While conditions in the test to make a set of steps run only if a specific condition is met.

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 in the test navigator panel.
  1. Click the Edit button, if it is displayed on the Test Editor page. Otherwise, go to step 3.
    The Edit branch dialog is displayed.
  2. Select an existing edit branch or create a new edit branch.
  3. Click the Flow catalog in the Catalog tab in Test Editor.
    The catalog elements are displayed.
  4. Select an element to perform the steps as follows:
    Catalog element Description Action
    Run You can run a test that is created for the same application as the current test. You can add the test after any step within the test. Perform the following steps:
    1. Drag and drop the Run element under any test step as required.
    2. Click the Run step.

      The step details pane is displayed.

    3. Select a test from the list in Path or drag and drop the .yaml file in the designated field.
    Fail You can abort the test and mark the test as failed. For example, you can add this element as a resulting step after checking a condition by using the If statement. Perform the following steps:
    1. Drag and drop the Fail element under any test step as required.
    2. Click the Fail step.

      The step details pane is displayed.

    3. Enter a custom message in the Fail statement text box.
    If You can insert the If logic in a test to make a set of steps run only if a specific condition is met. Perform the following steps:
    1. Drag and drop the If element under any test step as required.
    2. Click the If step.

      The step details pane is displayed.

    3. Select a variable in the Value 1 list.
    4. In the Operator field, indicate the basis of comparison of the two operands. Note that the two operands are strings.
    5. 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 If statement in the text box.

    6. 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

    While 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. Perform the following steps:
    1. Drag and drop the While element under any test step as required.
    2. Click the While step.

      The step details pane is displayed.

    3. Select a variable in the Value 1 list.
    4. In the Operator field, indicate the basis of comparison of the two operands. Note that the two operands are strings.
    5. 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.

    6. 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

    Do-While You can insert the Do-While logic in a test to make a set of steps run in a loop only if a specific condition is met after the first iteration. Perform the following steps:
    1. Drag and drop the Do-While element under any test step as required.
    2. Click the Do While step.

      The step details pane is displayed.

    3. Select a variable in the Value 1 list.
    4. In the Operator field, indicate the basis of comparison of the two operands. Note that the two operands are strings.
    5. 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 Do-While statement in the text box.

    6. 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

  5. Click the Save icon to save the modifications.
You have added steps from the Flow catalog to define the flow and add conditional logic in a Web UI test.
You can run the test and view the results. See Running a Web UI test.