Test data-driven variables

Data-driven variables can be manually created at the test level as a way to create a placeholder for variables that you expect to be passed during a test run. Test data-driven variables are useful in the following situations:

  • The test uses shared variables in a plan run. (See Sharing variables between tests).
  • You are planning to associate the test with a DataTable but haven't created the DataTable yet. (When you're ready to create the DataTable, you can click on the "Generate DataTable" button on the Test Details page.)

Creating test data-driven variables

When creating data-driven variables, you must assign a default value that will be used in case there isn't any value passed on to the test for that variable from an external source, such as a DataTable.

You can create test-data driven variables in the mabl Trainer using one of the following methods:

Create a new variable

  • Click on the {x} button in the bottom toolbar of the mabl Trainer.
  • Select Create a new variable
  • Set the variable's source to Data source.
  • Enter a variable name and default value.
  • Click Save. Variables created from Data source do not generate a test step.
584584

Create a new variable using "Data source"

Use the Manage variables tab

  • Click on the {x} button in the bottom toolbar of the mabl Trainer.
  • Select the Manage the variables in this test. The Manage Variables tab displays all data-driven variables for the test with their default values.
  • Click Add variable.
  • Enter a variable name and default value.
  • Click Save.
590590

The Manage Variables tab

Using data-driven variables

You can use data-driven variables just like any other variable, including the following:

  • in assertions
  • as input values
  • as URLs to visit
  • in template strings to generate other variables
  • in custom JavaScript steps

Editing default variable values

On the Test Details page

  1. Click on the Edit variables button in the Data-driven variables section.
  2. Update the default values.
  3. Click Save.
600600

In the mabl Trainer

You can also update (and delete) test data-driven variables in the mabl Trainer:

  1. Click on the {x} button in the bottom toolbar of the mabl Trainer.
  2. Select the Manage the variables in this test.
  3. Update the values.
  4. Click OK to save your changes.

Identify flow data-driven variables

If a data-driven variable includes information in the Notes column, it indicates that this variable is a flow data-driven variable. Clicking on the name of the flow takes you to the Flow Details page. (If this space is empty, the variable is a test data-driven variable.)

600600

Create a DataTable

You can create a DataTable table from the Test Details page by clicking the Generate DataTable button. You will be redirected to the DataTable editing screen, where you can add different scenarios to test. Alternatively, you may want to first create a DataTable and then associate it with the test.


Did this page help you?