While Loop

While Loop enables a test case to repeatedly execute a set of steps as long as a specified condition evaluates to true, allowing controlled and condition-based iteration within the test flow.

If certain steps need to be repeated until a condition becomes false (for example, retry login until successful), add them under the While section.

  • Click "While Loop" to add a loop block in the test case.

  • Set Condition for While - Choose how to set the condition:

    • Element

    • Parameter

  • Element - Choose "Element" when the condition depends on an object (UI element, text, etc.) on the screen.

    • From the dropdown, select the required option:

      • Conditions (is visible, is not visible)

      • Actions

      • Interactions (click, type, focus, etc.)

    • Select the required "Object" (stored using XPath / Playwright).

    • Set Max iterations (default: 100).

      • Example: To retry login until the success message appears:

        • While "Login Successful" message is not visible → condition is true

        • If the message becomes visible → condition becomes false

        • The system will keep retrying login until the message appears or max iterations are reached

    • Click "Save" to apply the condition.

  • Parameter - Choose "Parameter" when the condition depends on a value.

    • From the 1st dropdown, choose an existing parameter OR Click "Create to add a new parameter" :

      • Enter Name (e.g.,retry_count)

      • Enter Value (e.g., 0)

      • Select Type (String, Number, etc.)

      • Click Create

    • From the 2nd dropdown, select the comparison type:

      • equals

      • not equals

      • greater than

      • less than

      • contains

    • Enter the comparison value (e.g., 3).

    • Set Max iterations.

      • Example: To retry login for limited attempts:

        • While retry_count < 3 → condition is true

          • If retry_count ≥ 3 → condition becomes false

          • The system will retry the steps until the condition becomes false or max iterations are reached

    • Click "Save" to apply the condition.

  • While (Loop Steps)

    • Add the required steps under While.

    • These steps execute repeatedly as long as the condition is true.

  • End While

    • End While marks the end of the While loop.

    • It closes the loop block and completes the flow.

      • The loop stops when:

        • Condition becomes false

        • OR max iterations limit is reached

      • If needed, update or modify the description

      • Click "Save" after changing description

  • Example Flow

    • While login is not successful:

      • Enter username and password

      • Click login

      • Wait for response

    • After End While:

      • If login is successful → go to dashboard

      • Else → show error and stop execution

    • Continue with remaining test steps

Last updated