Skip to end of metadata
Go to start of metadata

A Loop will execute its child objects multiple times within a test case iteration. Loops allow simplifying recording test scenarios consisting of repeated actions.  

 

To create a loop, perform the following steps:

1. Go to the Build Test Case node.

2. Select the starting page, top-level request, or transaction

3. Open the Context Menu by right mouse clicking.

4. Click Create Container -> Create Loop.

Quick Create:

Another way to create a loop is to select multiple objects the test case tree -> right-click -> select Create Loop. That will create a loop around the selected objects.

5. A new loop dialog will appear.

6. Select the last request or transaction in the loop.

7. Give it a meaningful description (optional).

8. Click Create Loop. A basic loop will be created. To change the loop definition, click Edit on the toolbar.

9. Re-open the Context Menu by right mouse clicking and click Show Properties.

10. set the Number of Repeats property to the required number of loop iterations

11. Optionally, specify in the Delay before next Loop property, the number of seconds that will be injected before starting the next loop cycle.

 



Conditionally running a loop


A conditional loop will execute its child objects multiple times if a given condition is true (or false)The condition will compare an extractor to a string to determine if the child objects should execute.

 

To create a loop, perform the following steps:

1. In the property, When to run the loop, select Check a condition first.

2. In the property, An extractor name, select an extractor from the drop-down to compare with the string. 

Note

 The extractor must be defined before the Loop object

2. In the property, A string to match, enter a string to compare with the extractor.

3. In the property Run the loop if match? select Yes to run the loop when the extractor matches the string, and skip the loop when the extractor does not match the string. Select No to skip the loop when the extractor matches the string, and run the loop when the extractor does not match the string.

  




Conditional loops


Sometimes it is not possible to determine in advance how many times a loop should be repeated. A conditional loop will check a condition to determine whether to start the next loop iteration.

Two types of conditions are supported.

    • A  Search response condition depends on finding a specified text or regular expressions in response.
    • A  Match extractor condition depends on matching an extractor value with a specified text.


To create a loop, perform the following steps:

1. In the property, Loop type, select Conditional

2. Select Condition type as Search response or Match Based

3. The search response condition is based on finding a specified text or regular expressions in an HTTP response. For this condition type, specify the following:

a. From the drop-down, select Response to search, where the specified text or regular expressions will be searched.

b. In the Search string property, specify a character string that will be searched in the HTTP response.

c. In the Search type property, select Text if the search string is a text, or select RegEx if the search string is a regular expression.

d. In the Exit While Loop if match found? property select Yes to repeat the loop when the search text is not found, and exit the loop when the search text is found. Or select No to repeat the loop, when the search text is found and exit the loop when the search text is not found.

4. The match extractor condition is based on evaluating an extractor. For this condition type, specify the following:

a. From the Extractor to match drop-down, select the name of the extractor that will be used for the match.

b. In the Value to match property, specify a text to match the extractor's value with.

c. In the Exit While Loop if match found? property, select Yes to repeat the loop, when the extractor's value does not match value to match, and exit the loop when the extractor value matches. Or select No to repeat the loop when the extractor value matches, and exit the loop when the extractor value does not match.

5. In some cases, if the condition is not met after maximum attempts, it is important to stop executing the test case. For example, if the test case fails to log-in after a few attempts, it doesn't make sense to execute post-login transactions. Use the Action on loop completion after max. repeats property to control the outcome of failed conditions. 

a. Continue: To continue the iteration

b. Abort iteration: To stop the current iteration and start a new one

c. Abort vu: To stop sending requests from this VU.

  




Iteration-bound datasets

To increment the index for iteration-bound datasets on every loop iteration set the Increment the index for iteration-bound datasets property to Yes. For more information on databinding, see Databinding.


  • No labels