We practice reuse every day, such as recycling cans and bottles or giving new life to old objects by repurposing them. Why? Because it saves resources and time.
One of the fundamental principles of software engineering is reuse. We create methods or functions that we call instead of duplicating code. This is also true for coded tests.
However, when it comes to codeless test automation, we often don’t reuse our tests or test components enough.
In this blog, we will explore the benefits of reusing test components, how to create and share groups in Testim, and an exciting new feature called Auto Grouping that can make this much easier.
Importance of Using Groups
In Testim, a group is a collection of steps, that may include other groups. Groups are reusable, and can be shared across tests. We recommend using groups wherever you have recurring steps. Why? Because groups help improve the visible flow of a test and reduce test maintenance time.
Let’s look at the login example. For many applications, you need to log-in before you can access the application’s functions. From a testing perspective, this means that nearly every test needs to start with a login. Creating a test is simple enough by recording the actions of clicking in the user and password fields, entering the appropriate data, and clicking on the login button.
It’s so simple in fact, that many testers will rerecord those steps for every test. As a result, their tests look bloated with multiple steps taking up space in the visual editor. A login group takes up less visual space so users can more easily see what the test is meant to accomplish. Groups can also minimize the endless scrolling that can occur with long tests.
More importantly, what happens if the product team decides to change the login process to add a second authentication step? Without a group, every test that had login steps would need to be updated.
If instead, a login group was created to represent the login steps, updating the dozens or hundreds of dependent tests is as simple as updating the steps in the login group.
This can be a massive time saver.
Creating Groups
To create a login group in Testim, select the steps, select the group button, name, and save the group.
Once created, you can reuse the group across tests that require the login steps. If there’s a change to the login process, a single fix within the group can fix all tests using that group.
While groups are a great benefit in reducing test maintenance, they still require that you consciously create the group. In addition, creating a group doesn’t mean that it is reused properly across tests. For a frequently used set of steps like those in the login group example, you can have tests that should use the group but don’t. You could also create multiple “login” groups that are duplicative.
How do you use groups more frequently and properly within tests? Auto Grouping might be the solution.
Auto Grouping
Auto Grouping is a new feature we just released that helps you identify duplicative steps that could be replaced with groups.
Let’s start with what is available today, and then we will discuss what is coming.
Today, when you decide to create a new group, you will have an opportunity to use the auto group functionality to search for other tests that use the same steps.
For instance, suppose that you are creating a new group for login steps. When you create that group, you will now have the option to have Testim check for similar steps in other tests. If found, it will create a new test branch and insert the new group in the applicable tests.
When the group is created, it will notify you of any tests where the new group was inserted to replace existing steps.
As this operation is a batch editing operation that can potentially affect multiple tests, currently auto grouping will automatically be done in a new branch, so you can validate the changes without affecting other teammates’ work. Once you validate that the new branch works as expected, you can safely merge it back to your main branch. Alternatively, if you determine that the new group should not move forward, you can revert by deleting the branch.
What’s next?
Of course, we will continue to solicit and implement feedback from the current release as we want it to be as useful as possible.
We are already working on the next phase which we hope to release shortly. This next phase will allow users to scan all the tests in their project looking for common steps. It will then recommend groups that can be implemented into those tests.
Imagine if you have 200 tests and find that 50 of them use the same three steps. This next phase will suggest a group that can be implemented across those 50 tests. Then, if a change is needed to a step in that group, instead of fixing it 50 times, you can fix it once.
We are just getting started with our enhancements to auto-grouping.We believe this is a powerful feature. We have our own ideas about how to make it more automatic (such as auto-grouping steps as they are recorded) and will be soliciting your feedback to make it more useful.
Summary:
We hope that you find this to be an exciting and useful new feature! We believe that the benefits will be easily realized.
As an example, one of our customers implemented a new identity verification process in their application and because they had used a group for those steps, they only needed a minor change to update all of their regression tests.
With auto grouping, you will be able to identify recurring patterns easier and create the groups you need to help simplify test maintenance when your application changes.
Note that this feature will be generally available on August 2, 2020.