Groups
Combine several steps into a group and start making use of reuse!
"Reuse" is one of the more basic principles of programming. Instead of copy-pasting the same twenty lines of code over and over, you write them ONCE inside a method and call it whenever you need to.
This principle works precisely the same in the world of automated testing, by grouping steps together and then making these groups available to be called from other tests in your project. Even if you don’t share groups between tests, you can still improve the organization of your tests, by using them to reduce the number of steps presented in the Visual Editor.
In addition to sharing groups, there are some steps that can be shared without the need to group them with other steps. For more information, see Shareable Steps.
Creating a Group
To create a group:
- Select multiple steps by holding the Ctrl (windows) or Command (mac) key while left-clicking on the steps, OR marking an area around the steps.
- While the steps are selected, click Add Group.
- In the Group Name field, enter a name for the group.
- If you want to make this group available to other tests in your project, select the Shared Group checkbox.
- If you want to enable Auto-Grouping, select the Apply auto group on matching steps checkbox and follow the instructions in Auto-grouping.
- Click Confirm.
The steps are grouped into a single group step. If the group is shared between tests, a Shared indicator icon is displayed.
- To view the individual steps within the group, double-click the group.
Specifying Group Properties (optional)
On the Group Step, click the Show Properties () icon to open the Group Properties pane.
Property | Description | Comment |
---|---|---|
Shared step name | The name of the group. | Changing the name will modify all instances. |
Description | The group’s description. | Can be different for each instance of the group. |
Replace with clone | Creates a copy of the group that can be modified without modifying the other instances. | |
Params | See - Parameters for groups | Changing the name will modify all instances. |
When this step fails | What occurs if the group step fails | Changing the name will modify all instances. |
When to run step | Creates a breakpoint where a condition can be specified when to run this group step. To learn more about Conditions, see - Conditions | Changing the name will modify all instances. |
Repeat group | Creates a loop based on conditions. To learn more about loops, see - Loops | Changing the name will modify all instances. |
Context | Assigns entire groups to different elements of the page and across pages. To learn more, see - Group context | Can be different for each instance of the group. |
Reusing a Group
You can reuse a group within the same test and if the group is a shared group, you can reuse it in other tests within your project.
To reuse a group within the same test:
- Hover over the > (arrow symbol) between the two steps.
The action options are displayed.
- Click on the folder (Shared steps).
The Shared steps menu opens.
- Click the group name to add it as a new step.
The group is added as a step in the Editor.
You can use the search box to help you find your group.
- If the step expects you to pass parameters, don't forget to assign them by editing the param values (to learn more, see Parameters section). Each step passes its own parameters (e.g. you could call the "login" with "David" as params in one test, and with "John" in another).
Note
It is also possible to copy/cut and paste the group. See Editing Tests.
To reuse a group in another test:
- In the other test, hover over the > (arrow symbol) between two steps, or the + (plus symbol) after the last step.
The action options are displayed.
- Click on the folder (Shared steps).
The Shared steps menu opens.
- Click the group name to add it as a new step.
The group is added as a step in the Editor.
You can use the search box to help you find your group.
Modifying Groups
You can modify an existing group and if this is a shared group, the modification will apply across all tests that use the group.
Note
if it's a shared group, but you don’t want the changes to apply to the other tests, you can use the Replace with clone feature and then modify this group only.
To modify a group:
- Access the group details, by doing one of the following:
- In the test that includes the group, double-click the group step.
- If it's a shared group, you can go to Test List > Shared Steps, hover over the group and click See all tests using this shared step. Click one of the tests in the list and then in the test, double-click the group step.
- In the group details screen you can modify the test by:
- Recording additional steps at the beginning/end of the existing steps - to add additional steps, you will need the have the AUT opened in the state of the last step (before adding the new steps). To do that, you need to:
- Specify a breakpoint in the last step (before the new steps)
- Run the test again.
- stop the test.
- Go into the Group Details and begin recording the new steps as shown below.
- Recording additional steps in the middle of the existing steps. - you will need the have the AUT opened in the state of the last step and then record the additional steps as shown below:
- Reordering or deleting steps - you can reorder the steps by dragging them to the desired location. Delete steps by selecting them and then pressing DELETE.
Tip
After modifying the group you may want to change its name in the Properties pane to reflect its new functionality.
- To get back to the test either click the Back button or on the name of the test on the top left.
Removing the reuse option
You can remove the reuse (share) option from a group without deleting it. This does not delete it from the existing tests, just removes the option to reuse it and add it to tests again.
To remove the reuse option:
- Go to Test Lists > Shared Steps
- Select the group
- Click the Hide button, either from the top menu or the context menu
This will hide the selected shared step(s) from the shared library. Steps that have already been used in your tests will not be affected.
Changing one instance of a Shared Group by replacing it with a clone
Changing shared group in one place will change it in all instances of the branch. Although you can send different parameters to different instances of the shared group, sometimes you need to make changes only in a specific instance (i.e. in a specific test). For this purpose, you will want to clone the group.
To clone a group
- Edit the shared group that you wish to clone.
- In the Properties panel, click Replace with a clone.
- Enter a new name for the group.
- Decide whether the new step will also be defined as shared.
- Click Confirm.
The group and all its steps will be cloned. Shared steps and nested steps will remain shared.
Updated over 1 year ago