Loop Step
The Loop step repeatedly executes a set of child steps until an exit condition is met, a timeout expires, or the maximum iteration count is reached.
When to Use
- Polling an API until a status changes (e.g., wait for "completed")
- Retrying an operation until it succeeds
- Iterating over a dynamic data set where the number of items is unknown
- Waiting for an asynchronous process to finish with a bounded retry
Configuration
Exit Condition
Defines when the loop should stop. The condition is evaluated after each iteration.
| Field | Description |
|---|---|
| Variable Name | The name of the variable to evaluate. When empty, the loop body runs exactly once and exits. |
| Comparison Mode | How to compare the variable against the expected value |
| Expected Value | The value to compare against. Not used for Existence/NonExistence modes. |
| String Compare Mode | Binary (case-sensitive), CaseInsensitive, Loose (ignores spaces), or RegularExpression |
Comparison modes:
| Mode | Description |
|---|---|
| Existence | Variable exists (has been set) |
| NonExistence | Variable does not exist |
| Equals | Variable value equals the expected value |
| Contains | Variable value contains the expected value |
| NotContains | Variable value does not contain the expected value |
| StartsWith | Variable value starts with the expected value |
| EndsWith | Variable value ends with the expected value |
| MatchesRegex | Variable value matches the given regular expression pattern |
Limits
Safety limits that prevent infinite loops.
| Field | Default | Description |
|---|---|---|
| Max Iterations | 100 | Hard cap on the number of iterations (range 1–999999). When reached without the exit condition being met, the step fails. |
| Timeout | 00:01:00 | Total wall-clock time limit. When this expires, the step fails. Accepts formats like 00:01:30 or 30s. |
Delays
Optional pauses to control pacing.
| Field | Default | Description |
|---|---|---|
| Before First Iteration | 00:00:05 | Delay before the first iteration begins |
| Between Iterations | 00:00:05 | Delay between consecutive iterations |
Steps
The child steps that execute on each iteration. Drag any supported step type into the Steps list. Steps are executed in order, top to bottom.
Runtime Behavior
- The step checks for user abort (
Stopflag) before each iteration. - If Before First Iteration delay is set, the step waits before the first iteration.
- All enabled child steps run in order.
- After each iteration:
- The exit condition is evaluated.
- If satisfied, the loop exits with Success.
- If Max Iterations is reached or Timeout expires, the loop exits with Failure.
- Otherwise, Between Iterations delay is applied and the next iteration begins.
- Iteration progress is reported in the step output and test log.
If no exit condition variable is configured (Variable Name is empty), the loop body runs exactly once and the step returns Success.
Example: Polling for Completion
Step 1: Send Request (POST /api/jobs)
→ stores job ID in the variable JobId
Step 2: Loop
Exit Condition:
Variable Name: Status
Comparison Mode: Equals
Expected Value: completed
Max Iterations: 20
Timeout: 00:02:00
Between Iterations: 00:00:05
Steps:
Step 2.1: Send Request (GET /api/jobs/${JobId})
→ stores status in the variable Status
Step 2.2: Assert
variable Status is not "failed"
Step 3: Assert
variable Status equals "completed"
${JobId} is a variable reference in a URL, so it is substituted at send time. Status in the
Variable Name field is the name itself, written bare.