Running tests with a DataTable

How to configure your tests to run with a DataTable

DataTables run the same test multiple times with a different scenario with a different set of data each time. This guide provides an overview of the different options when running DataTables for ad hoc runs and plan runs and reviewing the test output.

2396

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:

  1. Navigate to the test you wish to run.
  2. Click on the Run test button.
  3. Configure DataTable settings for your test
    • For a local run, toggle on "Run DataTable scenarios" and select the DataTable and the scenario. You may only run one DataTable scenario for a local run.

  • For a cloud run, toggle on "Run DataTable scenarios" and select the DataTable. You may run all scenarios or select a specific scenario for a cloud run.

  1. 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.

  1. 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.

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:

  1. Navigate to the plan you wish to edit.
  2. Click on the pencil icon to open the Edit plan page.
  3. Find the specific test in the Tests section.
  4. Click the pencil icon to open up the options panel.
873

Editing the test settings in the Edit plan page

  1. Click on the + Add parameter button.
  2. Set the Type field to "Ignore DataTables." This parameter prevents the test from using any associated DataTables.

  1. Click Done to confirm your settings.
  2. 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:

  1. Navigate to the plan that you wish to edit.
  2. Click on the pencil icon to open the Edit plan page.
  3. Find the specific test in the Tests section.
  4. Click the pencil icon to open up the options panel.
  5. Click on the + Add parameter button.
  6. Set the Type field to "DataTable."
  7. Set the DataTable field to the specific DataTable you wish to use for this plan run.
430

Selecting a specific DataTable for a plan

  1. Click Done to confirm your settings.
  2. 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.

967

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 Run history tab to view the scenario name for each run.

1277

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:

  1. From the Test Output page, click on View all.
1258

Test Output page

  1. 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.
1237

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:

  1. On the Test Output page, click on the Edit test button.
  2. 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.
1202

Launching the Trainer with the DataTable scenario used in a test run