Skip to main content

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.

FieldDescription
Variable NameThe name of the variable to evaluate. When empty, the loop body runs exactly once and exits.
Comparison ModeHow to compare the variable against the expected value
Expected ValueThe value to compare against. Not used for Existence/NonExistence modes.
String Compare ModeBinary (case-sensitive), CaseInsensitive, Loose (ignores spaces), or RegularExpression

Comparison modes:

ModeDescription
ExistenceVariable exists (has been set)
NonExistenceVariable does not exist
EqualsVariable value equals the expected value
ContainsVariable value contains the expected value
NotContainsVariable value does not contain the expected value
StartsWithVariable value starts with the expected value
EndsWithVariable value ends with the expected value
MatchesRegexVariable value matches the given regular expression pattern

Limits​

Safety limits that prevent infinite loops.

FieldDefaultDescription
Max Iterations100Hard cap on the number of iterations (range 1–999999). When reached without the exit condition being met, the step fails.
Timeout00:01:00Total wall-clock time limit. When this expires, the step fails. Accepts formats like 00:01:30 or 30s.

Delays​

Optional pauses to control pacing.

FieldDefaultDescription
Before First Iteration00:00:05Delay before the first iteration begins
Between Iterations00:00:05Delay 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​

  1. The step checks for user abort (Stop flag) before each iteration.
  2. If Before First Iteration delay is set, the step waits before the first iteration.
  3. All enabled child steps run in order.
  4. 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.
  5. 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.

See Also​