With flow parameters, you can scope variables to a single flow or reuse a flow with different variables. This article shows you how to work with parameterized flows in the mabl Trainer, including how to…
- Add parameters to a new flow
- Override default parameter values
- Update default parameter values
- Add parameters to an existing flow
- Export flow parameters outside a flow
- Remove flow parameters
How to add parameters to a new flow
To add flow parameters to a new flow, take the following steps in the mabl Trainer:
- Click on + (Add step) > Create a flow.
- Give the flow a name.
- Click on the Parameters tab.
- Click Manage parameters to add new parameters.
- Give your parameters a name and a default value. You may enter a static string or number, a random value using valid expressions, or reference another variable using mabl variable syntax (
{{@testVar}}
). - Click OK to save your changes.
If you use a variable as a flow parameter value, make sure that variable is initialized before the start of the flow. Otherwise, the step that uses the flow parameter will provide the value [not yet evaluated]
.
Flow parameter variables are prepended with flow.
, and they are only available when the Trainer cursor is within the Start flow and End flow steps. For example, if a flow has a parameter testVar
, the parameter becomes the variable flow.testVar
within the flow.
How to override default parameter values
To override a flow's default parameter values, take the following steps:
- Click on the pencil icon to edit the flow.
- Click on the Parameters tab.
- Update the parameter value(s) to override the default.
- Click OK to save the override.
Overriding flow parameters in one instance does not update parameter values in other instances of the flow, even within the same test.
Overriding default parameters
How to update default parameter values
To update a flow's default parameter values, take the following steps:
- Click on the pencil icon to edit the flow.
- Click on the Parameters tab.
- Click on Manage parameters.
- Update the default parameter value(s).
- Click OK to save the new default parameter values.
Updating the default parameter values changes the values for any instance of the flow that uses the default parameter values.
Updating default parameter values
How to add parameters to an existing flow
To add parameters to an existing flow, open a test that contains the flow in the mabl Trainer and take the following steps:
- Click on the pencil icon to edit the flow.
- Click on the Parameters tab.
- Click on Manage parameters to add new parameters.
- Give your parameters a name and a default value.
Be sure to replace any variables you want to parameterize in the steps within the flow with your newly added parameters.
Replacing values in a flow with flow parameters
How to export flow parameters outside a flow
If you want to use a flow parameter outside a flow, create a new variable within the flow that uses the flow parameter as its value.
For example, if you want to use the variable flow.searchResult
outside of the flow, create a new variable named mySearchResult
and give it the value {{@flow.searchResult}}
.
If you use the name of a variable already used earlier in the test, you will overwrite the original variable.
How to remove flow parameters
To remove flow parameters, open a test that contains the flow in the mabl Trainer and take the following steps:
- Click on the pencil icon to edit the flow.
- Click on the Parameters tab.
- Click on Manage parameters.
- Remove the parameters.
- Click OK.
If you remove parameters, change the steps in the flow to use regular variables instead of flow parameters or revert the flow version to a version before you started using parameters. Otherwise, the step that uses the flow parameter will provide the value [not yet evaluated]
.
Deleting flow parameters