Features & Scenarios
Manage Test Cases
Test Cases for Android & iOS Apps
Test Cases for Mobile Web Apps
Test Case List Actions
Importing Postman Collections and Environments
Custom Fields for Test Cases
Label Management
Update Test Case Result in a Test Plan- Test Step Types
Type: Natural Language
Type: REST API
Type: Step Group
Type: For Loop
Type: While Loop
Type: Block
Type: If Condition
Nested Step Groups
Image Injection
Cross-application testing
While Loop in Test Cases
In Testsigma, you can create a while loop to execute a test step repeatedly if a specified condition remains true. While Loop iterates through the step until the condition becomes false and then stops executing the test step and moves to the next test step. This article discusses using While Loop in Testsigma.
Prerequisites
Before you begin, ensure that:
- You have installed the Testsigma Recorder Extension. For more information on installing chrome extension, refer to the documentation on installing chrome extension.
- You have referred to the documentation on creating test cases.
Using While Loop in Test Cases
- Navigate to Create Tests > Test Cases, and click on Create Test Case.

- On Test Case Details page, click on the option on the left side of the test step.

- This will open a side panel.
- Hover over to the options and click on While Loop. This will add a while condition in your test step.

- Hover over the test step and click on Step Inside Loop to add sub-steps under the While Loop.

- This will create a test step number 2.1 which will be under step 2.

Adding While Loop in Test Cases Using Recorder [Web & Mobile web]
- Navigate to Create Tests > Test Cases, and click on Create Test Case.

- Click on Record.

- A new window will be opened with recorder.
- Go to https://demoqa.com/webtables.

- Click on the option on the left side of the test step and choose While Loop. This will add a while condition in your test step.

- Hover over the test step and click on Step Inside Loop to add sub-steps under the While Loop.

- You can continue to add sub-steps and click on Stop Recording once all steps are added.

For more information on creating steps using recorder, refer to recording test steps.
Adding While Loop in Test Cases Using Recorder [Android & iOS]
- Navigate to Create Tests > Test Cases, and click on Create Test Case.

- Click on Record. This will open Record test steps overlay.

- Select the Test Lab, Test Machine, App Source and click on Record.

- Wait until the virtual app is loaded.
- On Test Recorder, click on the option on the left side of the test step and choose While Loop. This will add a while condition in your test step.

- Hover over the test step and click on Step Inside Loop to add sub-steps under the While Loop.

- Record all the steps and click on Stop Recording to quit the session.

Additional actions possible on iteration count
- Store: Iteration count is the current count that is being iterated in a while loop in Testsigma. This Iteration Count can be stored into a variable for later use as well. Below is how the syntax for the Store NLP looks like:

- if: The test data set values, from a test data profile being iterated, can be compared within an if condition too. Below screenshot shows the NLP (The NLP can be added as a part of add-on String Compare. You can find the add-ons to use here: https://testsigma.com/addons):
