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

Variables overview

Variables in mabl come in a few different categories:

Type

Description

Example

Application URL

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.

app.url (in browser tests)
api.url (in API tests)

Environment variables

Environment variables* are set in the Configuration section and become available whenever a test is run against an environment.

Commonly used for API keys

Credentials

Credential sets* can be created in the Configuration section and are assigned to tests and plans at training and runtime.

username: app.defaults.username;
password: app.defaults.password

Test-generated variables

These variables are created by a test step, using Create variable (excluding "Data Source"), 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.

flow.productId
flow.quantity

Runtime variables

Variables whose values are generated at runtime, such as the test run ID and loop index (during a loop).

run.loop_index

Data-driven variables

User-defined variables that get their values before a test or flow starts running.

  • Configuring a test to receive shared variables in a plan run.
  • Running a test through a set of scenarios defined in a DataTable

*Credentials and environment variables are encrypted.

See all variables in the mabl Trainer

If you need to check the variables while you are training a test, you can take the following steps:

  1. Click on the "{x}" button in the Trainer window.
  2. Select "Use all variables and their current values" in the menu that appears.

A window will display the variables available for the test with their current values and value source.

994994

The View All Variables modal

📘

Not yet evaluated

For variables that are generated during a test step, you will see [not yet evaluated] before the test step has run.

See all variables in a cloud run

If you want to review the variables from a test run, take the following steps:

  1. Navigate to the Test Output page.
  2. Click on View all >. A Test Details modal will appear.
  3. Click on the link to View variables.
600600

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:


Did this page help you?