Using variables in the mabl Trainer

There are many actions in the mabl Trainer that allow for the use of variables:

Depending on the type of step, you will either select the variable from a dropdown or reference it in a string with mabl variable syntax.

📘

Mabl variable syntax

A variable can be referenced in mabl tests by prepending the variable name with an @ symbol and wrapping it in double curly braces {{ }}.

For example, if you want to reference a variable called "product_id", you can write {{@product_id}}

Input values

Once a variable is defined, you can use that variable as an input value:

  1. Click on the "{x}" button.
  2. Select "Use an existing variable" in the menu that appears.
  3. Click on the Input value button. (For URL to visit, check out this guide.)
  4. Select a page element (an input field or textarea) into which the variable's value should be inserted.
  5. In the mabl Trainer window, choose the variable from the dropdown.
298
  1. Click OK. The variable's value will be inserted into the selected input field on the page.

Referencing variables

Using mabl variable syntax, you can combine variables with other variables or static text and use them in input steps, assertions, conditionals, and steps that use additional find criteria (Configure Find and custom find).

Here is an example that updates an existing input step:

  1. Click on the pencil icon for the input step. A configuration menu will appear where you can update the value.
299
  1. Use mabl variable syntax to reference the variable. This example references the variable new_user, which has a current value of "user789". In the preview, {{@new_user}}@email.com appears as [email protected].
298
  1. Click OK. When you play the step again, it will enter the value shown in the preview.

Here is an example of an assertion that references a variable:

297

📘

Limitation to referencing variables

Variable interpolation is not supported in data-driven variables or environment variables. This means that their values cannot contain references to another variable, such as {{@anotherVar}}.