Training tests with DataTables

How to train and edit tests with DataTables

This guide explains how to set up DataTable scenarios for training in browser tests and API tests.

Browser tests

New tests

If you are creating a new browser test, you can choose a DataTable for training under the Show advanced options section. Make sure that Train with DataTable is toggled on.

2218

Associating a new browser test with a DataTable

When you open the new test in the mabl Trainer, the test will use the values from the first scenario in the DataTable. If you want to use values from a different DataTable scenario, save your changes and follow the steps for existing tests.

Existing tests

When editing existing tests, you can select a specific DataTable scenario for training by following these steps:

  1. Navigate to the Test Details page of the test you would like to edit.
  2. Click on the Edit steps button. The Edit Test Configuration modal will appear.
  3. Make sure the toggle "Populate data-driven variables from a DataTable" is enabled.
  4. Select the DataTable and specific scenario that you would like to train with.
  5. Click the Launch Trainer button.
1882

Training a browser test with a specific DataTable scenario

You may also launch the mabl Trainer with the DataTable scenario used in a specific test run. From the Test Output page, click on the Edit test button and select either "Launch Trainer" or "Launch and replay to failed step." This option makes it easier to investigate and debug a test run.

3000

Launch a training session to the DataTable scenario used during a test run

Checking scenario values

If you want to check the scenario values while training a browser test, click on the {x} variables button and select View all variables and their current values.

The View Variables modal will show the DataTable scenario and values that are used for the current training session.

1986

DataTable scenario values in the View Variables modal

API tests

To edit an API test with a DataTable scenario, you need to add the variable names from the DataTable and the values from the scenario manually.

For example, consider the following DataTable:

Scenariofirst_namelast_nameemail
User AJohnSmith[email protected]
User BJaneDoe[email protected]

If you wanted to train with the variables in this DataTable, you would need to take the following steps for each variable (first_name, last_name, email):

  1. In the API Test Editor, click on the Add row button in the Variables section
  2. Add the variable name. Make sure that the variable names match the DataTable variable names exactly.
  3. Add a default scenario value. To train with the values from the User A scenario, you would add these variables to the API Test Editor:
844

Adding DataTable values to the API Test Editor

While editing, the API Test Editor uses the default values that you added manually. When you run the API test locally or in the cloud, the default values are overridden by values from an associated DataTable. Learn more about working with data-driven variables in API tests here.