With nested flows, you can build reusable hierarchies into your tests by importing a flow inside another flow, with flow parameters passed down through each layer. When you update a nested flow, the change propagates to every parent flow that uses it.
This article explains how nested flows work in mabl.
Early access
Nested reusable flows are available in early access through Labs. To enable the feature, a workspace owner can toggle it on under Settings > Labs in the mabl web app.
Nested flows are supported in browser and mobile tests.
Adding a nested flow
Adding a flow inside another flow follows the same process as adding a flow to a test. The key difference is that the step cursor must be positioned inside the parent flow.
The nested flow appears as a collapsible section within the parent flow.
Step numbering reflects the nesting hierarchy, for example: 3.1.1, 3.1.2.
Nesting depth
Flows and step groups share a maximum nesting depth of 4 levels. This depth limit is reached when you have three nested containers, either flows or step groups. Any steps within the innermost container are considered level 4.
For example, consider the following test structure:
- Test step
-
Start step group “Session setup” (level 1)
-
Start flow “Login” (level 2)
-
Start flow “MFA verification” (level 3)
- Flow steps (level 4)
- End flow
-
Start flow “MFA verification” (level 3)
- End flow
-
Start flow “Login” (level 2)
- End step group
This structure uses all 4 available levels. If you attempt to import or add a flow or step group inside of “MFA verification”, the buttons will appear disabled because it would exceed the depth limit.
Variable scoping
Variables in nested flows work the same way they do in non-nested flows:
-
Flow parameters are only accessible within that flow’s Start flow and End flow boundaries, using the
flow.prefix. - Variables created by a test step in a nested flow are accessible to any step that runs after them, including steps outside the flows.
What makes nested flows different is that you can pass flow parameters from one level to the next. For example, imagine an outer flow called “Session setup” with a parameter username. Inside “Session setup”, you import a “Login” flow that has its own parameter login_user and set that parameter to override to {{@flow.username}}. The value of the outer flow is resolved, then passed down to the inner flow.
Circular reference prevention
mabl automatically prevents circular references. If Flow A contains Flow B, you can’t import Flow A inside Flow B, because that would create an infinite loop: Flow A calls Flow B, which calls Flow A, and so on.
When you import a flow, mabl checks the entire chain of nested flows in both directions. If importing the flow would create a cycle at any depth, the flow appears as disabled in the import list.