---
source_url: "https://docs.virtuoso.qa/guide/introduction-to-virtuoso/checkpoint-loops/"
title: "Loops | Virtuoso Guide"
mirrored_at: 2026-08-06T01:06:25.825Z
host: docs.virtuoso.qa
cited_in_42a: true
mirror_canonical: "https://index.42a.ai/docs.virtuoso.qa/guide/introduction-to-virtuoso/checkpoint-loops/index"
---

> **Original source:** https://docs.virtuoso.qa/guide/introduction-to-virtuoso/checkpoint-loops/

Loops in Virtuoso provide a simple yet powerful way to repeat test steps within checkpoints. This feature enables you to loop over checkpoints without the need for complex scripting, eliminating the need for manual duplication of repetitive steps, streamlining test automation workflows while maintaining efficiency and clarity.

## [#](#who-should-use-this-feature) Who should use this feature?

-   **Users** who need to validate multiple UI elements dynamically (e.g., image carousels, product bundles, retry operations) or require loops that automatically adapt to test data variations.
-   **Teams** looking to streamline test workflows without writing complex scripts.

## [#](#key-benefits) Key benefits

-   **Simplified test design**: Configure loops with a simple toggle between Fixed and Conditional modes.
-   **Efficiency**: Loops adapt dynamically to test conditions, skipping unnecessary steps.
-   **Customization**: Users can define their own execution logic via conditions.

## [#](#how-it-works) How it works

Loops are configured within the context of a specific journey and are not properties of checkpoints themselves. This means that setting a loop on a checkpoint in one journey has no effect on the same checkpoint in any other journey. Each journey's loop configuration is independent, ensuring that loops apply only to individual checkpoints within that particular journey and do not extend across multiple journeys.

![Loops overview](https://docs.virtuoso.qa/assets/img/loops-overview.bd44eabd.gif)

Virtuoso offers two modes for configuring loops — **Fixed** and **Conditional** — to accommodate different testing needs. Whether you need a specific number of iterations or dynamic behavior based on conditions, loops make it easy to streamline repetitive tasks and adapt to varying test scenarios.

### [#](#_1-fixed-mode) 1. Fixed mode

-   The checkpoint executes a **specific** number of times (up to **10**).
-   Users can enter a **static number** or use a **variable** to define iterations.

### [#](#_2-conditional-mode) 2. Conditional mode

-   The checkpoint executes based on a _Variable-based_ or _JavaScript expression_ condition.
-   Users can enter a **static number** or use a **$variable** to define the max number of iterations (up to **10**).
-   The **condition** is evaluated before each iteration, and the loop continues as long as it evaluates to `true` or until the **maximum iteration count** is reached.
-   You can choose to **skip condition evaluation on the first iteration** by enabling the corresponding option.
    -   This ensures that the first iteration always runs, with the condition being evaluated only from the second iteration onward.
    -   **Note**: The first iteration is included in the **maximum iteration count**.

## [#](#configuring-loops) Configuring loops

Loops can be configured in one of two modes. This section walks you through the steps to enable and configure loops.

### [#](#step-1-enable-loops-on-a-checkpoint) Step 1: Enable loops on a checkpoint

1.  Open a journey and navigate to the checkpoint where loops are needed.
2.  On the checkpoint options, select the option **Add loop**. ![add loop via checkpoint settings](https://docs.virtuoso.qa/assets/img/add-loop.d00e82d9.png)

### [#](#step-2-select-loop-mode) Step 2: Select loop mode

-   Choose either **Fixed** or **Conditional** mode.  
    [image]

#### [#](#fixed-mode-configuration) Fixed mode configuration

1.  Select **Fixed** as the loop type.  
    [image]
2.  In the **Loop for** field, enter a number (max **10**) or a variable (e.g., `$iterations`).
3.  Click **Save** to apply the settings.

#### [#](#conditional-mode-configuration) Conditional mode configuration

1.  Select **Conditional** as the loop type.  
    ![loop mode conditional](https://docs.virtuoso.qa/assets/img/mode-conditional.88c9c6b7.png)
2.  Enter a **maximum iteration count** (max **10**).
3.  Select the type of condition and configure the condition: [Variable-based](https://docs.virtuoso.qa/guide/introduction-to-virtuoso/checkpoint-loops/#variable-based) or [JS expression](https://docs.virtuoso.qa/guide/introduction-to-virtuoso/checkpoint-loops/#js-expression).
4.  If you want the first iteration to always be executed, choose **Skip condition evaluation on first iteration** option.
5.  Click **Save** to apply the settings.

Loops limitations

Loops are limited to a maximum of 10 iterations. This limit is enforced in both modes of loops, **Fixed** and **Conditional**.

##### [#](#variable-based) Variable-based

With this option you can define simple conditions using an intuitive and self-explanatory interface to determine whether the checkpoint loop iteration should be executed. You start by specifying a variable using the syntax `$variable`. Then, there are six operator choices available for defining the condition:

-   **is defined**: When selecting the _is defined_ operator, the condition will evaluate to true if the variable is defined and has a value. By using the _is defined_ operator, you can execute an iteration based on the presence of a specific variable.
-   **is not defined**: The _is not defined_ operator functions as the inverse of the _is defined_ operator. It evaluates to true if the specified variable is not defined or does not have a value. This operator allows you to execute an iteration when a particular variable is absent or empty.
-   **is empty**: The _is empty_ operator will execute the iteration if a variable is defined, but has no value. Note that the iteration will fail if the variable is undefined.
-   **is not empty**: The _is not empty_ operator will execute the iteration if a variable is defined, and has any value. As above, the iteration will fail if the variable is undefined.
-   **equals**: The _equals_ operator allows you to compare the values of two variables, or the value of a variable against a fixed value. If the values are equal, the condition will evaluate to true, and the iteration will be executed.
-   **is not equal to**: Similar to the _equals_ operator, the _is not equal to_ operator compares the values of two variables, or the value of a variable against a fixed value. If the values are not equal, the condition will evaluate to true, and the iteration will be executed.

Supported syntax

To define a condition variable, you can optionally use the dot notation to access an object's property (`$variable.prop1.prop2`). For using the bracket notation, please use the "Advanced" option explained below. When using a fixed value as the condition's right operand, it has to be either a number (e.g. `42.5`) or a string (e.g. `English`).

Here is how you should configure it:

1.  Enter a the **left operand** by selecting or typing a `$variable`.
2.  Select the **operator**.
3.  (Required for binary operators) Enter a the **right operand** by selecting or typing a `$variable` or `value`.

![loop mode conditional variable based](https://docs.virtuoso.qa/assets/img/condition-variable-based-binary.35699f4f.png)

##### [#](#js-expression) JS expression

This option allows you to execute the checkpoint loop iterations based on the evaluation of a JavaScript (JS) expression. If the JS expression evaluates to a truthy value, the iteration will be executed. Otherwise, it will be skipped. This option requires more technical knowledge, but covers some edge cases not supported by the _Variable-based_ option.

Here is how you should configure it:

1.  In the **Condition** field, enter a JavaScript expression to control execution.
    -   Example: `$response?.status !== 200` (loop will continue until the API returns `200`).

![loop mode conditional js expression](https://docs.virtuoso.qa/assets/img/condition-js-expression.afbcd944.png)

## [#](#skipping-checkpoint-execution-due-to-loop-configuration) Skipping checkpoint execution due to loop configuration

A checkpoint may not be executed if:

-   The iteration count is set to `0` (or evaluates to `0` using a variable).
-   The **condition** in a **Conditional** loop evaluates to `false` on the first run.
-   The **Skip condition evaluation on first iteration** is selected and it's the first iteration of the loop.

### [#](#example-use-case) Example use case

A test should run only if a specific value is present in a dropdown. If the value doesn’t exist, the entire checkpoint is skipped.

## [#](#key-use-cases) Key use cases

### [#](#_1-testing-carousel-images) 1. Testing carousel images

A user needs to verify images, titles, and links in a carousel. Instead of duplicating steps, loops iterate through stored values for each image variation.

### [#](#_2-scroll-bar-testing) 2. Scroll bar testing

A tester needs to validate if a scroll bar is shown inside a currency dropdown in cases where it has at least 10 currencies. Since the initial number of currencies may vary, a checkpoint first checks the list length and adds a currency if needed. This repeats until **10 currencies exist**, ensuring accurate UI validation.

### [#](#_3-handling-product-bundles-and-add-ons) 3. Handling product bundles and add-ons

A test must handle different numbers of add-ons per product bundle, as defined in test data. A loop automates the addition of items based on the number of add-ons listed in the test dataset, eliminating manual repetition.

Authoring a looped checkpoint shares the same capabilities as authoring any other checkpoint. ![loops authoring overview](https://docs.virtuoso.qa/assets/img/loops-live-authoring.a9273f3f.png)

We also offer a few utilities that can help you during the creation of steps inside a loop:

Notes & Considerations

-   **Conditional loops iterations**: In conditional loops, execution rows are pre-allocated for the defined maximum number of iterations. If fewer iterations are needed, some rows remain unused and are skipped.
-   **Scope of loops**: Loops apply only to **individual checkpoints** and do not extend across multiple checkpoints.
-   **No nested loops**: You cannot place one loop inside another.
-   **Checkpoint skipping**: If the loop condition evaluates to `false` before the first iteration, the checkpoint is skipped.
-   **Library checkpoints**: Loops configuration are not persisted in **Library Checkpoints**, as looping is tied to a specific journey.
-   **Condition handling**: If a Conditional loop’s condition never evaluates to `false`, execution stops at **10 iterations** to prevent infinite loops.

Last Updated: 7/1/2025, 7:57:14 AM