---
title: "Variables and test data"
section: "Automate"
description: "SmartestQA variables: the {{name}} syntax, steps that produce values, data sources, global parameters, datasets, environment variants, data-driven runs."
url: https://docs.smartestqa.ai/en/automate-test-data.html
audience: [customer, admin]
updated: 2026-11-08
keywords: "variables parameters {{ }} global parameter data source dataset excel test data data driven execute count rows environment variant output value get store variable json extractor tc: ds: excel:"
---
# Automate: Variables and test data

Steps rarely need fixed values. This page explains how a step reads a {{variable}}, which steps produce one, where data sources and datasets come in, and how a pipeline runs the same test once per data row.

## In short

**On this page you can**

- Insert a {{variable}} instead of a fixed value in any step.
- Store a value from the screen, an API or a query for later steps.
- Read test data from data sources, global parameters and datasets.
- Keep one value per environment with NAME_DEV , NAME_TEST , NAME_PRP .
- Run a test case once per dataset row in a pipeline.

**How to use it**

1. Select the step and click the data picker icon next to a value.
2. Pick a data source key, a global parameter or a dataset column.
3. To pass a value on, give the producing step a key such as orderNo .
4. Use {{orderNo}} in a later step, save and dry run.
5. In the pipeline, set the execute count to iterate over the dataset.

## How variables are written

A variable is a [name in double curly braces](https://docs.smartestqa.ai/en/automate-steps-variables.html#syntax). You can use it as the whole value or inside text: `Order {{orderNo}} was created`. When the step runs, the variable is [replaced by its value](https://docs.smartestqa.ai/en/automate-steps-variables.html#pass-values).

| Write | Means | Example |
| --- | --- | --- |
| `{{name}}` | A value from this run, or a [stored global parameter](https://docs.smartestqa.ai/en/automate-steps-variables.html#scope) | `{{orderNo}}` |
| `{{tc:name}}` | A value this test case produced | `{{tc:orderNo}}` |
| `{{tc:1484.name}}` | A value test case 1484 produced earlier in the [same pipeline run](https://docs.smartestqa.ai/en/schedule-create.html#run-order) | `{{tc:1484.customerId}}` |
| `{{ds:name}}` | A [key from a data source](https://docs.smartestqa.ai/en/data-source-variables.html) | `{{ds:adminUser}}` |
| `{{ds:name}}_column` | One column of a data source record | `{{ds:customers}}_email` |
| `{{excel:name}}_column` | One column of the current row of a [dataset](https://docs.smartestqa.ai/en/data-source-datasets.html#use-in-steps) | `{{excel:logins}}_password` |

The prefixes make the source explicit and are what the [data picker](https://docs.smartestqa.ai/en/automate-test-data.html#insert-variable) inserts. A name without a prefix still works, with limits ([resolution order](https://docs.smartestqa.ai/en/automate-test-data.html#resolution)).

## Insert a variable with the data picker

1. **Select the step**

   Click the step in the list. Its values open in [**Parameters List**](https://docs.smartestqa.ai/en/automate-editor.html#step-parameters).
2. **Open the picker**

   Click the picker icon next to the value (“Data Sources - Global Parameters - Datasets”). It is offered on typing, selection, navigation, hover, visibility, [assertion](https://docs.smartestqa.ai/en/automate-steps-assertions.html) and [global parameter](https://docs.smartestqa.ai/en/automate-steps-variables.html#global-parameter) steps, on all [mobile steps](https://docs.smartestqa.ai/en/automate-steps-mobile.html), and inside [code](https://docs.smartestqa.ai/en/automate-steps-code.html), [AI prompts](https://docs.smartestqa.ai/en/automate-steps-ai.html), [mail](https://docs.smartestqa.ai/en/automate-steps-mail.html) and [Kafka messages](https://docs.smartestqa.ai/en/automate-steps-kafka.html#produce).
3. **Choose the source**

   The dialog **Data Sources / Global Parameters / Datasets** has three tabs:

   - **Data Sources List**: [keys from the project’s data sources](https://docs.smartestqa.ai/en/data-source-variables.html) (**Connected Data Sources** or **All Data Sources**).
   - **Global Parameters List**: [variables that steps of this and other test cases produce](https://docs.smartestqa.ai/en/automate-steps-variables.html#producers), with the test case they come from.
   - [**Datasets**](https://docs.smartestqa.ai/en/data-source-datasets.html): [uploaded tables](https://docs.smartestqa.ai/en/data-source-datasets.html#upload); pick a column.
4. **Pick and save**

   Click the entry. The variable is inserted where your cursor was. Click **Save**.

   The value shows the variable in colour, for example `{{ds:adminUser}}`.

The picker warns you about [order mistakes](https://docs.smartestqa.ai/en/automate-steps-variables.html#scope): “This parameter is produced by this step, so it has no value inside the step itself” and “This parameter belongs to a later step and may not have a value yet”.

Data sources and datasets are set up in the [**Data Source**](https://docs.smartestqa.ai/en/data-source.html) module of the main menu.

## Steps that produce a variable

A step produces a variable when you give its output a name (a **key**). [Later steps read it](https://docs.smartestqa.ai/en/automate-steps-variables.html#pass-values) as `{{key}}`.

| Step | Produces |
| --- | --- |
| [Get](https://docs.smartestqa.ai/en/automate-steps-browser.html#get) (web), Get Text / Get Attribute / Store Variable ([mobile](https://docs.smartestqa.ai/en/automate-steps-mobile.html#data), [desktop](https://docs.smartestqa.ai/en/automate-steps-desktop.html#data)) | The text or attribute of a control; on a Get step, [transforms](https://docs.smartestqa.ai/en/automate-steps-variables.html#transforms) can clean it first |
| [API](https://docs.smartestqa.ai/en/automate-steps-api.html#extract-values) | Values extracted from the response by JSON path or XPath, plus `@status` and `@header:Name` |
| [Database](https://docs.smartestqa.ai/en/automate-steps-database.html#outputs) | One variable per selected column |
| [Mail](https://docs.smartestqa.ai/en/automate-steps-mail.html#outputs) | The OTP code or link found in the mail |
| [Network](https://docs.smartestqa.ai/en/automate-steps-network.html#outputs) | Values extracted from a network call |
| [Python, JS](https://docs.smartestqa.ai/en/automate-steps-code.html#output-modes), [AI step](https://docs.smartestqa.ai/en/automate-steps-ai.html#outputs) | The returned value, when the output is set to **VALUE** |
| [Global parameter](https://docs.smartestqa.ai/en/automate-steps-variables.html#global-parameter) | The keys and values you type into it |

- Keys can only contain letters, digits and underscore (“Parameter key can only contain letters, digits and underscore”).
- Each key that creates a variable must be unique in the test case. [Save](https://docs.smartestqa.ai/en/automate-editor.html#save) stops with “Names that produce a global parameter must be unique within the test case. Conflicts: …” otherwise.
- Code and AI steps have three output modes: **VALUE** creates a variable; **STATUS** turns the returned value into pass or fail and creates no variable; **NA** produces nothing. An AI step that performs an action ([AI Do](https://docs.smartestqa.ai/en/automate-steps-ai.html#ai-do)) has no output.
- A value longer than 8,000 characters is not stored.

[Kafka steps](https://docs.smartestqa.ai/en/automate-steps-kafka.html#results) produce no variable: the step dialog has no output fields. The exact parameters of each producing step: [step reference](https://docs.smartestqa.ai/en/automate-steps-variables.html#producers).

## Where a variable gets its value

**Resolving {{name}}** — When the step runs

```text
{{tc:name}}   1. values produced earlier in this test case (shared run data)
              2. values of earlier test cases in the pipeline
              3. the project's stored global parameter of that name
{{ds:name}}   the data source key          {{excel:key}}_column → the dataset row
{{name}}      1. values produced earlier in this test case
              2. only when the reference is the whole value: the stored global
                 parameter, i.e. this test case's variable, else a data source key or dataset
              (inside longer text, step 1 only)
environment variant first: NAME_<ENV> if it exists, else NAME
not found → the text {{name}} is used literally
```

**Example:** step 3 is a Get with key `orderNo` and reads `A-1029`. Step 7 types `{{orderNo}}` into a search field: it types `A-1029`. If step 3 is [deactivated](https://docs.smartestqa.ai/en/automate-editor.html#activate-deactivate), step 7 looks for a stored global parameter `orderNo`: [values that steps produce are also stored](https://docs.smartestqa.ai/en/automate-steps-variables.html#scope), so it may type the order number from an earlier run. If there is none, it types the literal text `{{orderNo}}`.

An [assertion](https://docs.smartestqa.ai/en/automate-steps-assertions.html) treats a variable it cannot find as empty and logs “{{x}} not found, treated as empty”.

> **Warning: A wrong value is worse than no value**
>
> Because unresolved variables are typed as written and stale values can come from earlier runs, check the [dry-run log](https://docs.smartestqa.ai/en/automate-dry-run.html#live-log) of the step that should produce the value. For an [API extraction](https://docs.smartestqa.ai/en/automate-steps-api.html#extract-values), for example, the log shows the stored value as `orderNo = A-1029`.

### Scope

- Run data belongs to one test case run. A test case does not see another case’s values by plain name. Step-level details: [How long a variable lives](https://docs.smartestqa.ai/en/automate-steps-variables.html#scope).
- In a [pipeline](https://docs.smartestqa.ai/en/schedule-create.html#run-order), a later test case reads an earlier one’s value with `{{tc:<caseId>.name}}`.
- A [template](https://docs.smartestqa.ai/en/automate-add-steps.html#add-template) runs inside its caller: it reads the caller’s variables and the caller reads what it produces. The template step’s **Reads** and **Produces** list them.

## One value per environment

A user name or a customer number often differs between [DEV, TEST and PRP](https://docs.smartestqa.ai/en/concepts.html#environments). Keep it as separate [data source keys](https://docs.smartestqa.ai/en/data-source-variables.html#environments) or [datasets](https://docs.smartestqa.ai/en/data-source-datasets.html#dataset-environments) named `NAME_DEV`, `NAME_TEST` and `NAME_PRP`, and use only `{{NAME}}` in steps. A run on TEST uses `NAME_TEST` if it exists, otherwise `NAME`. The suffix must be upper case and exact. A name you write with a suffix is used as written.

Example · data source keys

```text
adminUser_DEV   dev.admin@example.com
adminUser_TEST  test.admin@example.com
adminUser       fallback.admin@example.com

Step value: {{ds:adminUser}}   →   on TEST: test.admin@example.com
```

## Run a test case once per data row

A test case that reads `{{excel:logins}}_user` and `{{excel:logins}}_password` can run once for every row of the `logins` [dataset](https://docs.smartestqa.ai/en/data-source-datasets.html#loop). You set this in the pipeline, as the test case’s execute count, in [Schedule](https://docs.smartestqa.ai/en/schedule-settings.html#loop-dataset):

| Execute count | Runs |
| --- | --- |
| `{{excel:logins}}_#` | Every row, in order |
| `{{excel:logins}}_#5` | The first 5 rows |
| `{{excel:logins}}_?` | Every row, in random order |
| `{{excel:logins}}_?5` | 5 random rows |

Each row is a full run of the test case with a fresh browser. If you ask for more runs than there are rows, the rows repeat from the start.

> **Note: Dry run uses the first row**
>
> A [dry run](https://docs.smartestqa.ai/en/automate-dry-run.html) does not iterate. It uses the first row of each dataset and the values stored in the steps; [pipeline parameter](https://docs.smartestqa.ai/en/schedule-settings.html#pipeline-parameters) overrides do not apply.

## Test case values and pipeline values

Each pipeline keeps its own copy of the [parameters of the test cases it runs](https://docs.smartestqa.ai/en/schedule-settings.html#pipeline-parameters), so the same test case can run with different values in different pipelines. When you change a test case’s parameters, Save offers to sync them into its pipelines; see [Test Case Parameters Changed](https://docs.smartestqa.ai/en/automate-editor.html#sync-pipelines).

## Secrets and personal data

- Values typed into a step are stored in the test case and visible to everyone in the project. Put passwords and tokens in a [data source](https://docs.smartestqa.ai/en/data-source-secrets.html#where-secrets-belong) and reference them with `{{ds:…}}`, so they live in one place.
- Values typed into fields whose name looks like password, secret, token or PIN are shown as `••••••` in [run logs](https://docs.smartestqa.ai/en/report-steps.html#log-detail).
- The runner receives the values it needs to run the test, wherever it runs: [the server](https://docs.smartestqa.ai/en/schedule-where.html#server) or [your agent](https://docs.smartestqa.ai/en/schedule-where.html#agent).
- Use test users and test data. Never put real customer data into [datasets](https://docs.smartestqa.ai/en/data-source-datasets.html).

## If something goes wrong

- [The test typed `{{name}}` literally](https://docs.smartestqa.ai/en/automate-troubleshooting.html#fix-literal-variable)
- [A step used a value from an earlier run](https://docs.smartestqa.ai/en/automate-troubleshooting.html#fix-stale-value)
- [“Duplicate keys found in step:” or “Names that produce a global parameter must be unique…”](https://docs.smartestqa.ai/en/automate-troubleshooting.html#fix-duplicate-keys)
- [“This key is already registered as a global parameter…”](https://docs.smartestqa.ai/en/automate-troubleshooting.html#fix-global-param-exists)
- [“Parameter key can only contain letters, digits and underscore”](https://docs.smartestqa.ai/en/automate-troubleshooting.html#fix-key-format)
- [The dry run used only one data row](https://docs.smartestqa.ai/en/automate-troubleshooting.html#fix-dry-run-one-row)
