The loops will execute group of steps until a condition returns false.
You will define a condition, in a similar way to how you define it in other steps, as described here.
Create a group with the steps you want to repeat/loop.
Read here about creating groups.
How to add the loop condition
- Click on the group step you created.
- Open the property panel.
- Define a condition on "Repeat Group" section. You can define an element or a custom condition. Read here to learn more.
Note: The loop will continue as long as the condition returns true.
Click here to run a demo test of this example.
In some cases, you may want to retry again before declaring a true/false condition and entering a loop. e.g. long page loading time might require wait time before checking the condition.
Retry when condition fails:
Defines a time for retries when the condition is false until the loop stops.
By default, if the condition returns false on first try, the loop will immediately stop.
If you want the system to try again before exiting the loop, use this option.
Minimum pass duration when condition pass:
As a default, if the condition is true the loop will continue into the group. In some cases you might want to retry again before declaring a condition true and entering the loop.
Note: If the condition returns false on the first attempt, it will not retry again even if this option was marked.
How to change those times:
After running your test, you can go through each iteration and look at each of the results separately.
You can reach a specific result directly from the group's properties, or you can go over the different iterations from inside the group.
If one of the iterations failed, when entering the group, you will be taken directly to the failed iteration.
Note: Maximum iteration limit is 99 iterations.
In order to accomplish a for loop, you can use the global export parameter as an iterator.
Click here to run a demo test of the same example that was presented earlier this time with a for loop.
For each loop
In order to run the same set of actions\validations on similar elements, use the "for each" option.
- Create a group
- Click "Repeat Group"
- Click "For each"
- Choose the first repeating element (for example, first row of a table)
The group will run in a loop on all elements which are similar to the element chosen in step 4. This is useful to test a list of repeating elements like a table with multiple rows.
Click here to run a demo test.