- Docs
- Reference
- Step reference
- Data and variables
Data and variables
A variable carries a value from one step to another: an order number read from the page, a token from an API, a code from an email. This page explains how to save values, how to refer to them, and what happens when a reference cannot be resolved.
In short
On this page you can
- Read a value saved earlier with
{{tc:name}}in any step value. - Set fixed or combined values with the Global parameter step.
- Clean a value read by Get with transforms such as Trim or To Number.
- Use data source values with
{{ds:name}}and Excel columns with{{excel:key}}_column. - Read a variable of another test case in the same pipeline with
{{tc:caseId.name}}.
How to use it
- Add a step that produces a value: Get, an API JSON path, a Database output, a code step set to Value.
- Give the output a clear name, for example
orderId. - In a later step, type
{{tc:orderId}}or pick it with the parameter picker icon. - Add an Assertion on the variable when its value matters.
- Run a Dry Run and check the resolved value in the live log.
Pass a value from one step to another#
Save the value
Use a step that produces an output (see Steps that produce variables) and give the output a name such as
orderId. Names may contain letters, digits and underscore.Refer to it
In any later step value type
{{tc:orderId}}, alone or inside text:Order {{tc:orderId}} is ready. The picker icon next to a value field lists data sources, global parameters and datasets, and inserts the reference for you.Run
When the step runs, the reference is replaced by the value. The live log shows the resolved value.
Example: Type step value
{{tc:orderId}}→ log"1042" was entered into the "Search" field.
Reference syntax#
| Write | Reads | Example |
|---|---|---|
{{tc:name}} | A variable saved by a step of this test case (or of a template inside it). | {{tc:token}} |
{{tc:caseId.name}} | The variable of another test case that ran earlier in the same pipeline. | {{tc:1484.customerId}} |
{{ds:name}} | A value from a data source of the project. | {{ds:adminUser}} |
{{excel:key}}_column | A column of the current row of an Excel dataset. | {{excel:users}}_email |
{{name}} | The older form, without prefix. It reads a variable of this test case first. Only when no step produced it, and the reference is the whole value, it falls back to a data source key or dataset of that name. Inside longer text it reads only the run’s variables. Resolution order | {{otp}} |
- Resolution order: values saved in the current run first, then the project’s stored global parameters.
- Data-driven runs: a pipeline can run a test case once per data row. A Dry Run uses only the first row.
- Where it works: in every step value, including URLs, request bodies and headers, SQL queries, mail filters, Kafka messages, AI prompts and code.
Unresolved references stay as text
If no value is found, the reference is not replaced: a Type step types {{tc:orderId}} into the field. An Assertion treats it as empty and logs “{{tc:orderId}} not found, treated as empty”. Check the spelling and that the producing step ran before. See Troubleshooting.
Steps that produce variables#
| Step | How you name the output | What it holds |
|---|---|---|
| Get (web) | The parameter key | The element’s text, or its value |
| Get Text, Get Attribute, Store Variable (mobile, desktop) | The variable name in the step | Text, an attribute, or a fixed value |
| Global parameter | The key | The value you set (variables in it are resolved) |
| API Request | The key of a JSON Paths row | A response field, @status or a header |
| Database | Output Values, in column order | Column values of the first row (or row N) |
| Extract OTP, Extract Link, Wait for Mail | Output Variable, Subject Output, Content Output | The code, the link, the subject, the body |
| Network | Save to variable rows | Status, body field, header, duration, call count… |
| Python, JavaScript | Output set to Value, with a name | The value the code returns |
| AI Ask, AI Check, AI Chat | Output Value = Value, Variable Name | The AI’s answer |
- Names that produce a global parameter must be unique within the test case. Saving two outputs with the same name shows “Names that produce a global parameter must be unique within the test case. Conflicts: …”.
- If two earlier steps set the same name, the later one wins at run time.
- Values longer than 8,000 characters are not saved.
The Global parameter step#
Sets one or more variables to values you choose, without touching the app. Use it for test data that several steps share, or to build a value from others ({{tc:firstName}}.{{tc:lastName}}@example.com). It exists in every project type.
Open the dialog
Click More › Global parameter (on wide screens the toolbar shows it as Param). The dialog Add Global Param Step opens.
Fill it
Test Step Name, then Key (the variable name) and Value. The picker icon inserts a data source, global parameter or dataset reference.
Add more values
Select the step and use Add Param in the right panel for more key and value pairs.
The step shows the chip Param. When it runs, each value is resolved and saved; the log lists the keys and values.
If the key is already registered as a global parameter by another source, saving shows “This key is already registered as a global parameter, please change the key value.: key”. Pick another name.
Transforms on Get steps#
A Get step can clean the value it reads before saving it. Add a transform row in the right panel; transforms run in order, after the value is read. Transforms are offered only on Get steps.
| Transform | Value | Example |
|---|---|---|
| Trim | Optional characters | 34 → 34; with *: *34* → 34 |
| Trim Before | A text | USD:34 with : → 34 (removes the text and what comes before it) |
| Trim Before Back | A text | 34* with * → 34 (from the last match, removes it and what follows) |
| Upper Case / Lower Case | None | ok → OK |
| Replace | old=>new | 1.234 with .=> → 1234 |
| To Number | None | € 1.234,56 → 1234.56 (the last of . or , is the decimal mark) |
| To Integer | None | 76.9 → 76 |
| Round | Number of decimals | 3.14159 with 2 → 3.14 (binary rounding: 76.945 becomes 76.94) |
| Default Value | A fallback | empty → N/A |
| Substring | a:b | 2026-11-08 with 0:4 → 2026 |
A transform that cannot apply (no number found, no match) leaves the value unchanged; the step does not fail. The Timeout row sets how many seconds this Get step waits for its element (1–300).
How long a variable lives#
- Within a test case, a variable is available to every step after the one that saved it, including steps inside templates.
- In a pipeline, a later test case reads it as
{{tc:caseId.name}}. - Outputs are also stored as the project’s global parameters, so a reference can resolve to a value from an earlier run when the producing step did not run this time. Keep producing steps before the steps that read them.
Didn’t find your answer?Write to support with your project name and what you see on screen.
info@smartestqa.ai