Skip to main content

Use Test Data Variables in Test Scripts

Insert reusable Test Data Collection variables into a Test Script, add missing values, and check the collection and Test Case versions used by the script.

Use a Test Data Collection variable to keep a reusable value separate from your test instructions. Insert a reference such as {{customer_email}} into the script. Vansah displays its value when the reference can be resolved in the current collection and version.

For example, a variable named customer_email with the value [email protected] lets a step read “Enter {{customer_email}} in the email field.”

Before you begin

  • Open the Test Case and select the version you want to edit.

  • Make sure you have permission to edit the Test Case and its variables.

  • Check the Test Data Collection and collection version for that Test Case version. A variable available in another version may not resolve here.

1. Insert an existing variable

  1. Open the Test Script tab and edit the relevant field. In a Multi Steps script, you can use variables in Step, Test Data, or Expected Result.

  2. Place the cursor where the value belongs. Type {{ and start entering the variable name, or use the editor’s Insert collection variable control.

  3. Select the matching variable from the suggestions. Check that you chose the intended variable.

  4. Save the edited step or script using its save control.

The reference uses two opening and two closing braces: {{customer_email}}.

A variable reference inside the Expected Result field of a Multi Steps script.

2. Check the displayed value

When you leave edit mode, a resolved variable displays its value with a light-blue highlight. For example, {{customer_email}} displays [email protected].

A resolved variable value highlighted in light blue.

When you edit the field, the variable name appears as a reference again. This lets you identify the variable without replacing the reference with its displayed value.

The same script field in edit mode showing the variable name inside double braces.

What you see

What it means

A light-blue value

The variable was found and has a nonblank value.

A red reference such as {{customer_email}}

The variable is missing, invalid, or has an empty value. Check the collection and version before adding another variable.

****

The variable is marked sensitive, so this script view masks its value.

3. Add a missing variable

  1. Enter the new reference, such as {{order_total}}, and save the script field.

  2. If the reference is unresolved, hover over it. When the variable is missing, select the + action to open Add new variable.

  3. Check the Variable name, enter a useful Value, and optionally add a Description.

  4. Select Add and wait for confirmation. Review the script again to confirm the value resolves.

Add new variable dialog with Variable, Value, Description, and Add controls.

Use a name such as order_total. In the quick-add dialog, names start with a letter or underscore and can then contain letters, numbers, underscores, hyphens, or square brackets. Spaces are not allowed. The dialog limits each field to 225 characters.

If a variable already exists but its value is empty, update that existing variable in the Test Data Collection. An empty value does not provide the missing-variable Add action.

4. Manage the Test Case’s variables

  1. Select the Test Data Collection button near the Test Case’s version selector.

  2. Check the displayed Test Case version and the selected collection version.

  3. Review existing variables or use Add Variable to add one.

  4. Save your changes, return to the script, and verify the references resolve to the intended values.

Test Data Collection button beside the Test Case version selector.

Troubleshooting

Problem

What to check

No variable suggestions appear

Check that the Test Data Collection has loaded for the current Test Case version. Use {{ or the Insert collection variable control, then search for a variable in that collection version.

A reference remains red

Check whether the variable exists, has a nonblank value, and belongs to the current Test Case and collection versions. Use the picker to insert the intended variable again if needed.

The variable name already exists

Reuse or update the existing variable in that version instead of creating a duplicate.

The collection has reached its variable limit

A collection version supports up to 20 variables. Review existing variables before adding more.

You changed a value but the script still looks different

Confirm that you changed the collection version used by this Test Case version. Reopen the script and check the displayed value.

Related guides

Did this answer your question?