Running tests with a DataTable
How to configure your tests to run with a DataTable
When you run a test with a DataTable, mabl executes one run for each scenario, or row, of the DataTable(s) that it is associated with. For example, if you configure a test to run with a DataTable that has five scenarios, five separate test runs will be triggered.

Results from a test run with a DataTable
In order to run tests with DataTables, you need to associate the DataTable to the test first. You can run tests with DataTables ad hoc and as part of a plan.
Ad-hoc runs
You can configure an ad-hoc test run to use DataTable scenarios by taking the following steps:
- Navigate to the test you wish to run.
- Click on the Run test button.
- Select the Cloud run tab. Configure any settings as needed.
- Toggle on "Run DataTable scenarios."

- Click on the Start run button. When a DataTable is selected, the Start run button updates to reflect the number of runs (scenarios) that will be triggered.
Local runs
In a local run, the test uses the variable values from the first scenario. Running all DataTable scenarios in local runs is not supported.
Plan runs
If a plan includes a test that is associated with a DataTable, then by default the plan will run the test once for each scenario (row) in all associated DataTables by default. If that test is in a plan stage that runs sequentially, the tests will run one at a time in order through the DataTable scenarios.
Ignoring DataTables
To prevent a test from using a DataTable for a specific plan, take the following steps:
- Navigate to the plan you wish to edit.
- Click on the pencil icon to open the Edit plan page.
- Find the specific test in the Tests section.
- Click the pencil icon to open up the options panel.

Editing the test settings in the Edit plan page
- Click on the + Add parameter button.
- Set the Type field to "Ignore DataTables." This parameter prevents the test from using any associated DataTables.

- Click Done to confirm your settings.
- Click Save.
Setting one specific DataTable for a test
If a test that runs in a plan is associated with multiple DataTables, you can force the test to run with a specific DataTable by taking the following steps:
- Navigate to the plan that you wish to edit.
- Click on the pencil icon to open the Edit plan page.
- Find the specific test in the Tests section.
- Click the pencil icon to open up the options panel.
- Click on the + Add parameter button.
- Set the Type field to "DataTable."
- Set the DataTable field to the specific DataTable you wish to use for this plan run.

Selecting a specific DataTable for a plan
- Click Done to confirm your settings.
- Click Save.
Plans with DataTables and multiple browsers
If a plan is configured to run on multiple browsers and includes tests that are associated with DataTables, the plan will run those tests once for each DataTable scenario multiplied by the number of browsers configured.
For example, if a plan is configured to run on Chrome and Firefox and includes a test associated with a DataTable that has seven scenarios, the plan run will execute 14 runs just for the test associated with the DataTable.
Viewing scenario names
When you run a test that has an associated DataTable, scenario names are displayed on the Plan Details page, the Test Results page, and from the Test Output page for a specific run.
Plan details
Select Plans from the left-hand navigation and click on the specific plan to open the Plan Details page. You can find the scenario names by expanding a previous plan run in the "History" section.

DataTable scenarios in a plan run
Test results
Select Tests from the left-hand navigation and click on the specific test name to open the Test Details page. Select the Results tab to view the scenario name for each run.

DataTable scenarios for an ad-hoc run
Test output
When viewing the results of a specific test run that used a DataTable, you can view which scenario that test ran and its values by taking the following steps:
- From the Test Output page, click on View all.

Test Output page
- Click on View to show all variables for this test run. The Test Variables view shows the specific data-driven scenario for this test run and its associated values.

Viewing values for a DataTable scenario
If you are viewing the Test Output page for a browser test run, you can also open the mabl Trainer with the DataTable that was used in that specific test run:
- On the Test Output page, click on the Edit test button.
- Select "Launch Trainer" or "Launch and replay to failed step." Both options open the mabl Trainer with the DataTable scenario used in the test run.

Launching the Trainer with the DataTable scenario used in a test run
Updated 25 days ago