📢 Are you a TestProject user looking to migrate to an open source alternative?

Learn more

For Loop in Testsigma

In the article, Conditional statements in Testsigma, we saw the usage of ‘If and Else If conditions’ in Testsigma. Let us look at For loops and how to easily use them within Testsigma.

For loop is used to repeat the test steps for the selected test data profile with multiple data sets(inputs). There can be multiple steps and If-Else groups inside the For loop.

Let’s see a test case to understand this further.

For Loop Example

Let us start the Test Case with a simple Go to step. As the next test step, select the Test Step Type as “For Loop” to add For loop in the next Test Step.

Choose your already created or imported Test Data profile. Specify “Loop start” and “Loop end”(here we choose Loop start as 1 and Loop end as 3) for the loop.

Click on the Create button.

The For Loop group will be created and displayed as shown below.

Here [Registration data Profile] is the selected test data profile and [1-3] denotes the For loop start and loop end.

Click on the Add After button and add a Test Step. Let us input some value in the search field. Use the grammar, “Enter test data in the searchbox field”.

Delete the test data part. This will show a suggestions dropdown. Choose @|Parameter| from the suggestion.

Another suggestion dropdown with the test data name(s) as provided in the Test Data profile will appear now. Since I added just one test data value in the selected test data profile, only that one selection comes up.

Select the test data from the dropdown and click Create.

Run this test and the results page will show all the 3 iterations of the For loop group.

This is how we use For loop in Testsigma.

Have questions?

Please feel free to reach out at support@testsigma.com or leave us a message on chat 🙂

Test automation made easy

Start your smart continuous testing journey today with Testsigma.