> For the complete documentation index, see [llms.txt](https://docs.drizz.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.drizz.dev/writing-tests/which-variable.md).

# Variables & data

Drizz holds values in four mechanisms:  `SET` dataset variables and placeholders.

|               |                                                                                                            |
| ------------- | ---------------------------------------------------------------------------------------------------------- |
| **Platforms** | Android · iOS                                                                                              |
| **Naming**    | `snake_case`, case-sensitive                                                                               |
| **Lifetime**  | `SET` last one run. Dataset values come from outside the run                                               |
| **Reserved**  | `ctx` — `{{ctx.*}}` is set by Drizz and you can't assign to it                                             |
| **Watch out** | A dataset variable that shows **red** in the editor doesn't exist in the bound dataset. That run will fail |

## Prerequisites

None.

## The four mechanisms

|                      | Written as               | Where the value comes from                                                                      | Lives for                    | Reference it as |
| -------------------- | ------------------------ | ----------------------------------------------------------------------------------------------- | ---------------------------- | --------------- |
| **SET**              | `SET city = "Bangalore"` | Assigned in the script — a literal, another variable, an API field, or a structured screen read | The test run                 | `{{city}}`      |
| **Dataset variable** | `{{phone}}`              | A dataset, bound when the test plan runs                                                        | The run, supplied externally | `{{phone}}`     |

## Selecting a mechanism

Rows apply top to bottom. The first matching row wins.

| Condition                                                                  | Mechanism                | Written as                        |
| -------------------------------------------------------------------------- | ------------------------ | --------------------------------- |
| The value is on the screen now and several fields are needed as one object | `SET` with a screen read | `SET <var> = screen(...)`         |
| The value changes per environment, per account or per run                  | Dataset variable         | `{{var}}`                         |
| The value is fixed for this one test                                       | `SET`                    | `SET <var> = "<literal>"`         |
| The value comes from an API step                                           | `SET`                    | `SET <var> = API.<name>.response` |

A dataset variable is what makes one script run against staging and production, or across ten user accounts. Syntax for `SET` is on [Store & SET](/writing-tests/which-variable/store-and-set.md); dataset authoring is on [Datasets & test data](/writing-tests/which-variable/datasets.md).

All four mechanisms in one ShopEase test:

```
# ShopEase — apply a coupon and check the total drops

OPEN_APP {{app_package}}
Wait Until 5 Seconds

Type {{phone}} in the mobile number field
Tap on Get OTP
Type {{otp}} in the OTP field
Tap on Continue
Wait Until 5 Seconds

Tap on Cart
Wait Until 2 Seconds


Type {{coupon_code}} in the coupon field
Tap on Apply
Wait Until 3 Seconds
```

`{{app_package}}`, `{{phone}}` and `{{otp}}` come from a dataset bound to the plan.

## Naming

| Rule                | Detail                                                                                                                                                                                |
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Case                | `snake_case` for every mechanism — `subtotal_amount`, `customer_name`, `app_package`                                                                                                  |
| Case sensitivity    | Dataset variable names must match the dataset key exactly. `{{Phone}}` and `{{phone}}` are two different variables                                                                    |
| Reserved namespace  | `ctx` is reserved. `{{ctx.*}}` is populated by Drizz on every run, including inside modules. `SET ctx…` is rejected                                                                   |
| One style per value | A value that lives in a dataset is always `{{phone}}`, never `<phone>`. A placeholder is inert text — Drizz types the literal characters `<phone>` into the field and the step passes |

## Common mistakes

<table data-search="false"><thead><tr><th>What you write</th><th>What happens</th></tr></thead><tbody><tr><td><code>&#x3C;phone></code> for a value that's in the dataset</td><td>Drizz types the literal text <code>&#x3C;phone></code>. The step passes and the login fails</td></tr><tr><td><code>{{Phone}}</code> when the dataset key is <code>phone</code></td><td>Renders red in the editor, resolves to nothing at run time</td></tr><tr><td>Reusing one variable name for two different captures</td><td>The second write overwrites the first, permanently</td></tr><tr><td>A placeholder for a value managed centrally</td><td>It has to be edited by hand before every run. Use a dataset variable</td></tr></tbody></table>

## Next

* [Store & SET](/writing-tests/which-variable/store-and-set.md)
* [Datasets & test data](/writing-tests/which-variable/datasets.md)
* [Modules](/writing-tests/modules.md)

***

*Last updated: 6 August 2026*
