If a test or flow lists a data-driven variable that nobody on your team added, it's most likely a flow data-driven variable. mabl creates one when a flow uses a variable whose value is set outside the flow, such as by a prior test step, a DataTable, or an environment variable. The variable gives the flow a backup value, in case another test uses the flow without setting that variable.
This article explains where flow data-driven variables come from and how they behave across the tests that use a flow.
To pass data into a flow, we recommend using flow parameters because they give you more control over every flow instance and prevent unintentional updates. The primary function of flow data-driven variables is to serve as a backup in case the flow gets imported into a test where these variables haven’t been defined.
Creation of flow data-driven variables
If you create a flow that uses variables whose values are set outside of the flow, such as from a prior test step, environment variable, or DataTable, mabl creates flow data-driven variables when you save the test.
For example, imagine you create a flow that uses a variable userEmail that gets its value from a DataTable scenario. When you save the test, mabl detects that the userEmail variable is set from an external source and creates a flow data-driven variable.
This variable appears on the flow details page in the Data-driven variables section. The default value is set to the value that was used when the test was saved.
Note
Flow data-driven variables are only supported in browser and mobile flows.
While flows in API tests can access variables set outside the flow, mabl doesn’t create flow data-driven variables as a fallback mechanism. If an imported API flow uses variables that are set outside the flow, the flow either accesses the variable as set by the test or treats the variables as undefined.
Importing the flow into other tests
If you import a flow with data-driven variables into a different test, the flow data-driven variables are added to the test as test data-driven variables when you save the test. This transition occurs so that you can customize the variables’ default values on a test-by-test basis.
These variables appear on the test details page in the Data-driven variables section.
If you delete the test data-driven variables that came from the flow, the test falls back to the flow data-driven variables as a backup. This process ensures that you never run a flow with undefined variables.
Editing default values
If the default value of a flow or test data-driven variable is no longer relevant, you can update it by clicking on the Edit variables button.
To change a flow data-driven variable from a test, click the flow's name next to the variable on the test details page, and edit it on the flow details page.
A flow data-driven variable's default value is shared by every test that uses the flow. If you change or remove it, every test that relies on the flow's value instead of its own gets the change on its next run.