When you run a test with a DataTable, you can validate the reliability of your application across a range of different scenarios. Whether you want to test out one scenario locally or run multiple scenarios in parallel in a plan run, mabl offers several options to suit your needs.
This article explains how to run tests with DataTable scenarios ad hoc and in a plan run.
Before you start
To run tests with DataTable scenarios, you must first associate the DataTable to the test.
If the test is associated with a DataTable that you don’t have permission to access, you cannot trigger runs with those DataTable scenarios. In this case, you can associate the test with another DataTable and then trigger test runs.
Ad hoc runs
mabl supports ad-hoc runs with DataTable scenarios both locally and in the cloud.
Local runs
In the mabl CLI, you can trigger local runs with DataTable scenarios using the mabl tests run command:
- To run one scenario, use the
--scenario-idoption with the appropriate scenario ID - To run all scenarios sequentially, use the
--data-table-idoption with the appropriate DataTable ID
In the mabl Desktop App, you can trigger local runs of DataTable scenarios from the ad hoc run panel:
- Navigate to the test you wish to run.
- Click on the Run test button.
- In the Local run tab, toggle on “Run DataTable scenarios” and select the DataTable. You may run all scenarios or select a specific scenario for a cloud run.
- Click on the Start run button.
Cloud runs
You can trigger ad hoc cloud runs with one or all DataTable scenarios from the mabl Desktop App:
- Navigate to the test you wish to run.
- Click on the Run test button.
- In the Cloud run tab, toggle on “Run DataTable scenarios” and select the DataTable. You may run all scenarios or select a specific scenario for a cloud run.
- 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. When running all scenarios in the cloud, tests run in parallel.
You can also trigger a cloud run against one scenario or all scenarios from your AI client with the mabl MCP.
Plan runs
When DataTable scenarios run in a plan, the plan stage settings determine how the scenarios run:
- Parallel: scenarios run at the same time
- Sequential: scenarios run one at a time
By default, plan executions run all of the DataTable scenarios associated with a test.
Use caution when configuring multiple browsers for plans that run DataTable scenarios. The plan will run 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 7-scenario DataTable, the plan run executes 14 runs just for the test associated with the DataTable.
To limit the number of scenarios that run during a plan execution, use one of the following methods:
- Use specific DataTable scenarios
- Ignore all DataTable scenarios
Use specific DataTable scenarios
To only run specific DataTables or DataTable scenarios in a plan run, open the Edit plan page. In the Tests section, click on Show tests, and click on the Test variables button for the test you want to edit.
Edit test variables
In the Test variables panel, click on + Add parameter and set the Type field to “DataTable”. You may configure the plan to run all scenarios or specific scenarios.
For specific scenarios, there are two options:
- Dynamic: describe the scenarios to run in natural language, such as “Run all scenarios with the prefix ‘EN’” or “Run all scenarios where the user_role is ‘admin’”. mabl re-evaluates the description every time the plan runs. See write a dynamic scenario description.
- Static: manually select specific scenarios.
Select specific scenarios for a plan run
Write a dynamic scenario description
mabl evaluates your description against each scenario on its own. A scenario is selected when its own column values match the description, so write the description as a condition on a single row's values:
“Run only scenarios where the variable VPN has the value ‘VPN Missing’.”
“Scenarios whose region is Americas and whose market is CAN_Market.”
Descriptions that depend on comparing scenarios to each other aren't supported and can return a different set of scenarios each time the plan runs:
- Positional: “the first 3 scenarios”, “the last scenario”, “every other scenario”
- Comparative: “the cheapest plan”, “the scenario with the highest price”
- Aggregate: “rows that have a duplicate email”
To run a fixed or positional set of scenarios, use Static selection instead.
Quoted text must match the table exactly, including capitalization and spacing. If a value in the table contains a typo, such as VPN MIssing, quote it as it appears in the table.
Before you save, click Test to confirm the number of scenarios identified. The same description on an unchanged table returns the same count. If the count changes from one test to the next, the description is probably relative or ambiguous.
Ignoring DataTables
To prevent a test from using a DataTable for a specific plan, navigate to the plan you wish to edit, and click on the pencil icon to open the Edit plan page. In the Tests section, click on Show tests, and then click on the Test variables pencil for a specific test.
Edit test variables
In the Test variables panel, click on + Add parameter and set the Type field to “Ignore DataTables”. This parameter ensures that the test does not use any associated DataTables. Instead, the test will run just once with its default data-driven variables.
Ignore DataTables
DataTables at runtime
mabl uses the DataTable version available when a plan run is triggered. Any updates made to a DataTable after the plan run starts are not reflected in the tests executed in that specific plan run.