On the shared step edit screen, you can create a further shared step using the steps of that shared step. By creating nested shared steps in this way, you can gain advantages such as improved test readability.
However, there is a restriction on shared step variables.
Table of contents
Restriction
You cannot pass the variables of a parent shared step to the input fields of a child shared step.
When you try to create a shared step using steps linked to a connector, an error message will appear saying, "Line *: You cannot include the parent's shared step variables in the new shared step. For detail, please refer to this guide." and you cannot create the shared step.
In this case, you must disconnect the connection.
For example, if you want to create a new shared step from the second and third lines of a shared step defined as shown in the figure below, you would need to disconnect the variables Guest and Submit button with the input fields.
Figure 1. An example of steps which cannot be included in nested shared step.
Workaround (text variables only)
When you want to pass parent shared step variables to a nested shared step, you can achieve this by adding a Store fixed value command and connecting it to the parent shared step variable, especially when dealing with text variables.
For example, as shown in the figure below, the content of the parent shared step variable Guest is saved as ${Guest} in the second line. By passing ${Guest} to the shared step variable Name in the child shared step Enter Name on the third line, you can specify the text to be input into the Name Area.
Figure 2. Pass a variable from parent to child (parent shared step)
Figure 3. Pass a variable from parent to child (child shared step)
In figure 1 the Submit button variable accepts UI elements such as buttons. Currently, there is no workaround for passing UI element variables like this Submit button from the parent to the child shared step.