When automating user scenarios, it is common to have a test that needs to run multiple times with different sets of data.
For example, think about validating whether an ecommerce app correctly calculates shopping totals for different geographic areas. You could create separate tests that validate fees and taxes for different locations, but you would end up using the same steps for each test.
With the goal of simplifying this process and reducing the need to create and maintain a test for each type of transaction, in mabl you can create one test that runs the same steps for each geographic location according to a DataTable.
A DataTable is a table of data that defines what variables a test uses and what their values should be in each scenario.
In addition to the shipping scenario outlined above, some other use cases for DataTables include:
- Localization: testing the same page for content in different languages
- Search validation: checking that different search queries yield the expected result
In general, DataTables are useful for situations in which the test logic is stable, but the input or data changes frequently. In such cases, managing data in a DataTable can be quicker than managing input data within the mabl Trainer or the API Test Editor.
A DataTable consists of variables and scenarios. To explain these components, consider the following screenshot shown for the "localization" DataTable:
Each column header in the DataTable represents a data-driven variable that can be used in the test.
The "localization" DataTable shown above contains three variables:
Each row of a DataTable represents one scenario. The name of the scenario appears in the first column - "Scenario Name", and the subsequent columns show variable values in that scenario.
The "localization" DataTable shown above has three scenarios: "English", "Spanish", and "Japanese." In the "Spanish" scenario, for example, the value of the variable
login is "Iniciar sesión."
Here is a typical workflow for testing an application with DataTables:
- Create a DataTable with the scenarios you want to test.
- Create a new browser test and associate the test with the DataTable.
- Train the test with the DataTable, using the variables in the test when relevant. You can run the test in the mabl Trainer to confirm that it yields the expected result.
- Run the test ad hoc with DataTable scenarios enabled to test all scenarios.
Running DataTable scenarios
When DataTable scenarios are enabled for a test run, mabl triggers a run for each DataTable scenario in parallel.
For example, if the test runs with a DataTable that has five scenarios, mabl triggers five test runs: one for each scenario.
Updated 10 months ago