With data-driven testing you can parameterize your tests across different inputs that are loaded at runtime. When you are creating and editing these tests, “test data-driven variables” can serve as placeholders.
In mabl, test data-driven variables are useful when training or editing a test that will use shared variables during plan runs and to create variables that you will eventually convert into a DataTable
This article explains how to work with test data-driven variables, including how to:
- Create test data-driven variables
- Edit default values
- Convert test data-driven variables into a DataTable
Create test data-driven variables
When you create test data-driven variables, assign a default value to use while training and editing the test. Make sure the variable name matches exactly with the name of the variable that will be passed in at runtime, whether it’s a shared variable or a value from a DataTable scenario.
Browser and mobile tests
For browser and mobile tests, take the following steps in the mabl Trainer:
- Click on the {x} button in the bottom toolbar of the mabl Trainer.
- Select the option “Manage variables”.
- Click on the Data-driven variables button.
- Add the test data-driven variable with a default value.
- Save your changes.
You can now use the test data-driven variable like you would any other variable in the mabl Trainer.
Managing test data-driven variables
API tests
To create test data-driven variables for an API test, launch the API Test Editor and take the following steps:
- Expand the variables panel.
- Add the test data-driven variable with a default value.
- Save your changes.
You can now use the test data-driven variable like you would any other variable in the API Test Editor.
Location of the variables panel
Edit default values
To edit the default value of a test data-driven variable, click on the Edit variables button on the test details page. Update the default value and save.
Editing data-driven variables from the test details page
Flow data-driven variables
If a data-driven variable includes a link to a flow, it means that the variable is a flow data-driven variable. Click on the name of the flow to view or update the flow data-driven variable from the flow details page.
Convert test data-driven variables into a DataTable
To convert your test data-driven variables into a DataTable, click on the Generate DataTable button on the test details page.
On the new DataTable page, give the DataTable a name and name the first scenario. Add any additional configurations as needed, such as additional scenarios or resource group settings.
When you save the DataTable, it is automatically associated with the test. Moving forward, you can launch the Trainer or API Test Editor and associate the session with a DataTable for future test edits.