> OctoPerf load testing - Variable documentation page. To configure predefined variables (Constant, Random or CSV), in one place.

Source: https://api.octoperf.com/doc/design/edit-virtual-user/configuration/variables/

# Variables



![variables-menu](https://api.octoperf.com/doc/design/edit-virtual-user/configuration/variables/img/variables-menu.png){ align=left }

The variable page lets you configure, **variables to use in your virtual users**. 

These variables will be **shared across the project**, meaning they are available to any virtual user in this project. 

Because of that you should **pay extra care when making changes** since they can have an impact on several virtual users.

<div style="clear:both"></div>

## Variables list

![Variables list](https://api.octoperf.com/doc/design/edit-virtual-user/configuration/variables/img/variables-list.png "Variables list")

The variables page uses a layout with the list on the left and edition on the right. The list features all the usual possibilities as described in the [dedicated section about lists](https://api.octoperf.com/doc/navigation/#lists).

When a CSV variable has a problem, such as a missing file or a conflict with another variable, the list shows a status column: see [Where the problems show](https://api.octoperf.com/doc/design/edit-virtual-user/configuration/variables/csv-validation/#where-the-problems-show) and how to fix each problem in the [CSV Variable Check](https://api.octoperf.com/doc/design/edit-virtual-user/configuration/variables/csv-validation/#problem-index).

### Usage

![variable-usage](https://api.octoperf.com/doc/design/edit-virtual-user/configuration/variables/img/variable-usage.png)

A single click inside the usage section will **copy a variable name** in order for you to use it in your virtual user. This way you do not have to manually input the **${...}** syntax.

!!! info
    Variables can be used anywhere in your virtual user except in:
    

    - Container names
    - Request names
    
    This means you can use variables inside text content like in JSR scripts ([although not recommended](https://api.octoperf.com/doc/design/edit-virtual-user/action-types/jsr223-actions/#jmeter-variables-and-functions)) or inside [raw bodies of requests](https://api.octoperf.com/doc/design/edit-virtual-user/action-types/http-actions/#raw).
    Nested variables are possible but this [requires the use of a function](https://api.octoperf.com/doc/design/edit-virtual-user/functions/#__v).



## Variables types

<div class="grid cards" markdown>

-   :material-pi: Constant Variable

    ---

    Associate a single constant value to the variable name.

    [:octicons-arrow-right-24: Reference](https://api.octoperf.com/doc/design/edit-virtual-user/configuration/variables/constant/)

-   :fontawesome-solid-shuffle: Random Variable

    ---

    Associate a single random value to the variable name.

    [:octicons-arrow-right-24: Reference](https://api.octoperf.com/doc/design/edit-virtual-user/configuration/variables/random/)

-   :fontawesome-solid-arrow-up-wide-short: Counter Variable

    ---

    Increase the count inside this variable on every iteration.

    [:octicons-arrow-right-24: Reference](https://api.octoperf.com/doc/design/edit-virtual-user/configuration/variables/counter/)

-   :fontawesome-solid-file-csv: CSV Variable

    ---

    Use a [CSV formatted file](http://en.wikipedia.org/wiki/Comma-separated_values) for the values of the variable.

    [:octicons-arrow-right-24: Reference](https://api.octoperf.com/doc/design/edit-virtual-user/configuration/variables/csv/)

    [:octicons-arrow-right-24: CSV Variable Check](https://api.octoperf.com/doc/design/edit-virtual-user/configuration/variables/csv-validation/)

-   :fontawesome-solid-user-secret: Secret Variable

    ---

    The value of this variable is not visible anymore after its creation.

    [:octicons-arrow-right-24: Reference](https://api.octoperf.com/doc/design/edit-virtual-user/configuration/variables/secret/)

</div>

## Predefined variables

### JMeterThread.last_sample_ok

This variable contains **true** or **false** depending on the status of the last sample executed.

!!! example
    `${JMeterThread.last_sample_ok}` after a sampler ok, returns **true**

### START.HMS

This variable contains the JMeter start time in [UTC time](https://time.is/UTC).

!!! example
    `${START.HMS}` returns **122402** for a test started at 12:24:02.

### START.MS

This variable contains the JMeter start timestamp in [UTC time](https://time.is/UTC).

!!! example
    `${START.MS}` returns **1631190242724** for a test started at 12:24:02 on the 9th of september 2021.

### START.YMD

This variable contains the JMeter start date in [UTC time](https://time.is/UTC).

!!! example
    `${START.YMD}` returns **20210909** for a test started on the 9th of september 2021.

### TESTSTART.MS

This variable contains the test start timestamp in [UTC time](https://time.is/UTC). It differs from the JMeter start time since it measure the effective start time of the first thread.

!!! example
    `${TESTSTART.MS}` returns **1631190243262**

### \_\_jmeter.U_T\_\_

This variable contains the threadgroup name followed by `virtual user number`-`iteration number`.

!!! example
    `${__jmeter.U_T__}` returns **unOEv3sBYy9LOuX37AC2 1-1**
