The Group Context feature enables you to run groups of steps on other, slightly different, elements (contexts), without the need to manually reconfigure the steps. When setting a context for a group step, the locators in its steps are automatically and dynamically changed to fit the new context.
For example, if you created a group of steps for booking a reservation to Madan and you want to run that group for booking a reservation to Shenji, instead of manually changing the step details, Group Context will automatically make the appropriate adjustments for you.
For background information about Groups and Shared Groups, see Groups.
Examples of when you may want to use this feature include:
- Repeating elements – when you have similar elements repeating in the page and want to execute the same steps on each of them.
- Table rows – when you want to execute the same steps on each row in a table.
- Tabs or frames – when you want to use a group of steps, which were recorded on one tab, in another tab.
In case of multi tab application, when a step is recorded, the specific tab (e.g., tab #3) is stored. When the step is played, as part of test run, the Testim application looks for the tab based on two parameters: tab number and tab URL. The decision to run on a specific tab is based on these two parameters – so, the actual playing can result in a different tab number (e.g. tab #2) if both tabs URLs are identical.
The following procedure assumes that you have already created a shared group step that you would like to reuse in a new context. The procedure for creating a group is described here.
To set a context for a group:
- Hover over the > (arrow symbol) where you want to add your step.
The action options are displayed.
- Click on the folder (Shared steps).
The Shared steps menu opens.
- Select the desired group from the list of existing group steps.
The group is added to your test.
- Hover over the > (arrow symbol) to the left of that group step.
The action options are displayed.
- Click on the Toggle Breakpoint button.
- Click on the Play Scenario button, to run the test until the breakpoint.
- Hover over the group step you just added and click on the Show Properties () icon.
The Properties panel opens on the right-hand side.
- Click the down arrow next to Context, and select Custom.
The AUT browser opens.
- In the AUT browser, identify the relevant element (context) you would like your group to run on, and click on it to select it.
By default, when selecting context for a group, the application will be in "Context selection mode". In this mode the repeating elements on the page will be highlighted to help with the selection. To exit this mode and return to the normal selection mode, click Q on your keyboard.
- The selected element is shown in the Target element box in the Context section of the Properties panel.
The new context is automatically applied to the group step, with no additional need for you to reassign the step.
- Click on the Toggle Breakpoint button to remove the breakpoint.
Testim automatically identifies which steps in the group should run on the provided context, and which should run outside of it.
Click here to view a test where a group step has been applied to more than one context. Use the shared group step “book” to create a new booking for a different destination in the app by changing the Context of the group step.
Updated 14 days ago