Variables
Variables help address testing scenarios that require dynamic values. They also help with passing values to, from and in-between tests so you can keep your tests shorter and easier to troubleshoot and maintain.
Use cases
- Generating random values, including email addresses for email testing with mabl Mailbox
- Extracting values from element properties of the application under test
- Securely managing user credentials that are passed to a test
- Calculating dates and deriving other values using custom JavaScript code
- Performing data-driven testing to easily validate different scenarios
- Sharing variable values between tests
- Managing values at an environment level (API keys, endpoints) and using them across tests
- Applying math calculations on variables and numbers
Variables overview
Variables in mabl come in a few different categories:
Type | Description | Example |
---|---|---|
Application URLs are created and managed in the Configuration section. This variable holds the starting URL of the application, and is assigned at the beginning of the test based on where the application is deployed. It is typically configured in the plan(s) that contains the test or selected at the beginning of a training session. |
| |
Environment variables* are set in the Configuration section and become available whenever a test is run against an environment. | Commonly used for API keys | |
Credential sets* can be created in the Configuration section and are assigned to tests and plans at training and runtime. | username: | |
Test-generated variables | These variables are created by a test step, using Create variable , an API step, or mabl Mailbox. | Creating a random value |
Local variables | Local variables include flow parameters and snippet parameters, and they exist within the scope of the flow or snippet from which they are declared. |
|
Runtime variables | Variables whose values are generated at runtime, such as the test run ID and loop index (during a loop). |
|
User-defined variables that get their values before a test or flow starts running. |
|
*Credentials and environment variables are encrypted.
Managing variables in the mabl Trainer
If you need to view or update variables while you are training a test, take the following steps:
- Click on the
{x}
variable button at the bottom of the Trainer window - Select "Manage the variables in this test" to open the Variables modal.

The Variables modal
From the Variables modal, you can manage all the variables in your test in a table:
- Name: this column shows the names of the variables available in the test.
- Initial value: this column shows values of the variables and their variable source.
- Current value: in the Current value field, you may update the variable value in the current training session. Override values in the Current value field do not persist when the test is saved.
Note on test-generated variables
Test-generated variables, which are variables created by a test step, do not have an initial value. If a test-generated variable’s value is created from JavaScript, element extraction, mabl mailbox, or an API step, the Variables modal shows
[not yet evaluated]
for the current value until the step executes in the mabl Trainer.
Data-driven variables
Click on the Data-driven variables button to add, edit, or delete test data-driven variables.
Session configuration
Click on the Session configuration button to make changes to the test's configuration during the training session, including application, environment, credentials, and DataTable scenarios. These are the same settings that you select when you edit an existing test in the Trainer.
See all variables in a cloud run
If you want to review the variables from a test run, take the following steps:
- Navigate to the Test Output page.
- Click on View all >. A Test Details modal will appear.
- Click on the link to View variables.
The Test Variables modal shows initial and final variable values for a test run and indicates whether any variables were shared.
Learn more
To start creating and using variables in your workspace, take a look at the following guides:
Updated 3 days ago