New SDI Release Fixes Critical Start Debugging Issue
July 3, 2024The Future of Software Development: Embracing Cybersecurity and SOC 2 Type 2 Compliance
August 20, 2024“You’ve probably got a lot to do. I suggest you leave it to me.”
—HAL, 2001: A Space Odyssey
UI automation is an important part of testing any software product with a user interface. As the name suggests, it is the automated use of UI elements for various purposes, including testing. Testing using UI automation is more involved than unit testing and more prone to errors, but it is essential for verifying interactions between parts of a product’s UI. Since users of your application will interact with it primarily through its UI, this testing will help establish a basic level of quality for your product by ensuring UI interactions work as intended. And it will enable you to do this in less time than with traditional manual testing methods.
Here at Synergex, UI automation has greatly reduced the time and effort required to test new releases of our Synergy DBL Integration for Visual Studio (SDI) product. What used to be a two-week process, requiring a small team of testers on a handful of machines, is now a four-hour process that requires just one machine and one developer to start the process and interpret test results. Consequently, UI testing is more reliable, we’ve been able to expand test coverage for the SDI product, and we can retest more quickly should test failures occur. As a bonus, we now have more resources freed up to work on other projects.
Manual or automated?
You might be wondering how much of your application’s UI testing should be automated. A common phrase that’s thrown around is “Everything that’s automatable should be automated.” This statement is generally true since the more testing that’s automated, the better the baseline of quality and the greater the savings in time and resources. Manual UI testing can take days or even weeks for a product with any complexity, and the time required for this will increase rapidly as a product grows. However, as our experience with SDI shows, automating recurring UI testing tasks can save hundreds of hours per release, which shortens the release cycle and makes it possible to get software into customers’ hands more quickly.
Manual UI testing still has its place. Manual testing generally makes sense in the initial stages of a development project when there are few UI elements to interact with and when an effort to implement UI automation would outweigh the benefits. Additionally, there are subjective areas of UI testing that simply cannot be automated. For example, evaluating the look and feel of an application can’t be done with automation, and automated testing can’t tell you if your application is confusing or hard to navigate.
How we use UI automation at Synergex
We currently use UI automation to test a variety of scenarios within the SDI product, and one of the primary tools we use for this testing is TestComplete. We’ve created a library of UI interactions for this tool, and we use these UI interactions to test SDI’s integration with the Visual Studio editor. We call these interactions “script extensions,” and with this library we can quickly create tests by referencing sets of extensions. For example, we have an automated test that verifies that the “Create a New Project” window behaves correctly. For this automation to work, our test needs handling for menu operations so that it can open the window, and it needs window handling to manipulate the window. It must also have keyboard handling to enable it to enter data into various text boxes as required to test SDI’s integration with this window. Script extensions provide us with all these UI interactions, so we can simply reference them wherever they’re needed in our TestComplete tests.
As an example of what script extensions do for us, consider button clicks. It would certainly be onerous to program different click handling for each button, so we added a generic solution for finding and clicking buttons to our script extension library. To create a test that clicks a button, we simply reference the script extension with that functionality and call the button click function for the button that needs to be clicked. There’s no need to re-create button handling for a new test or button. It already exists in the script extension! And if a function doesn’t already exist for a type of UI element, it is simple enough to add it.
Script extensions form the core of our UI interactions for TestComplete, but there has been more to our automation efforts as we move to improve our DevOps processes. You can read more about our general testing process improvement in Stories from Synergex: Achieving DevOps through Continuous Integration.
Get started with UI automation
Starting up your own testing suite for automation is not necessarily difficult, but it does take time. First, you need to identify what you want to test, so it is important you know how users are going to interact with your application’s UI. With this knowledge, you can reproduce those interactions with UI automation. Several common areas of testing include menu operations, shortcuts, scrolling, and error logging. It is generally beneficial to start by thinking of entire workflows required to interact with your UI, such as purchasing an item from a store. For that process, UI automation would need to test logins, adding to a cart, viewing the cart, making payments, entering delivery details, and checkout.
The effort to automate even this one workflow would likely expose a lot of little details you may have overlooked in your initial plans for UI testing. Moreover, once you know the steps involved in the processes you are going to test, you can break UI interactions down even further into different scenarios for each step. For example, you might create a list of various scenarios for user logins, which could look something like this:
- User enters a valid username and password
- User enters a valid username but an incorrect password
- User enters an invalid username and an invalid password
- User clicks the Reset Password button
With these scenarios identified, you have an action plan for the tests you will need to make. You can then create your own testing tools library within your testing platform of choice to handle operations that are common to multiple tests, such as typing into the username field. When possible, these tests should be run against a production version of your product or website.
On your way to improved reliability
Hopefully this quick introduction to UI automation has given you a sense of how useful this testing is. And now that you have a basic understanding of how it can be used and how to create testing scenarios, you are well on your way to improving any product’s reliability.