Skip to main content

Reuse Content Across Tests: Use Variables

See how to reuse pieces of information across various tests so you only have to update that information once to have it up-to-date in all your tests.

Written by Aaron Collier

Sometimes you have pieces of information that you want to use in multiple tests that might change in different runs. For example, a link to the testing environment for a specific run, login information for a test user, or a Google Form that changes for each run. If you’re including that information in multiple tests, it can be painful to update it everywhere. And doing it manually creates the risk that you leave the wrong information some place.
​

Instead, use variables to change data in one place and have it update in multiple tests. Then when your testing environment URL changes between runs, you can just update the variable and all your tests will have the right information.

If the content is entire steps, see how to reuse steps across tests.

  1. In the Testlio platform, open the workspace where you want to reuse content.

  2. Click Settings.

  3. Expand the Tests category and click Variables.

  4. Click + New variable.

  5. Give it a unique name to remember (such as test_environment).

  6. Enter the value (such as the testing environment URL).

  7. Click Create variable.

    The modal to create a variable in the platform with the name and value filled in as in the example.
  8. In the top menu, click Tests.

  9. Open a test where you want to use the variable.

  10. For the step where you want to reuse the content, enter the variable name inside three curly brackets ({}, so {{{test_environment}}} in the example).

Now when you click away from that test step, you see the value you entered for the variable instead of its name.

A test step with the action as Go to the testing environment and the name in three curly brackets
A test step with the variable replaced with the URL.

Limitations

Historical data is not stored. So once you change a variable, all record of what it was before is gone. So be careful before you change the name or value.
​

Did this answer your question?