"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.
To create a group:
- Select multiple steps by holding the Ctrl 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.
On the Group Step, click the Show Properties () icon to open the Group Properties pane.
|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|
|When this step fails||What occurs if the group step fails|
|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 -
|Repeat group||Creates a loop based on conditions. To learn more about loops, see -|
|Context||Assigns entire groups to different elements of the page and across pages. To learn more, see -|
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:
- Click the “+” button > Groups Tab > there you will find a list of groups, including your newly created group.
- Click the group name to add it as a new step.
It is also possible to copy and paste the group.
To reuse a group in another test:
- In the other test, click the “+” button > Groups Tab > there you will find a list of groups, including your shared group.
- Click the group name to add it as a new step.
You can modify an existing group and if this is a shared group, the modification will apply across all tests that use the group.
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.
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.
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 Archive button.
This will archive the selected shared step(s) from the shared library. Steps that have already been used in your tests will not be affected.
Updated 23 days ago