TestProject Forum

Repeat step until it finds the specified value

Hello!

I was wondering if there was any way to make this happen. The repeat option allows me to repeat a step X number of times, but I want it to repeat only until a specified value is found and then resume the test. Could I use a condition to do this? How would it be?

Hi @HiLenn.

In that case you can repeat your step 100 times and add a condition.

How it will looks like depends on your scenario. Take a look on this example:

I want to generate a random integer on the website https://www.random.org/ until I get the number “5”

To achieve that, I’ll:

  • Add a step that clicks on the “Generate button” :

  • Add a step that get the result and store into a parameter :

  • Then I’ll group these steps into a test:

  • And finally I’ll add a loop(adding 100 to the “REPEAT” field) with the condition by opening the grouped steps and going to the advanced options:

image

Let me know if it helped :slight_smile:

Kind regards,
Ricardo.