Can we Automate UI Testing?
Most testers consider UI testing as the Achilles’ hell of automated testing and often just stick to manual testing for UI. There is no doubt that UI testing does have its challenges. It has complex workflows, is relatively much slower than Unit Tests and also is more brittle. This is mainly because UI testing has too many touch points and, depending on what is being tested, hit the file system, the database and sometimes the network services. They have to cross process and class boundaries and involve constantly changing UI elements such as JavaScript, HTML etc. Even if any one of these sections does not play along perfectly with the testing process you have a ‘broken test’ in your hand. So yes, UI testing is challenging. Having said that, we also want to emphasize that no other test will give you as much coverage as a UI Test.
Owing to this, most testers believe that automating UI testing will be more time consuming, brittle and expensive. So, is manual testing the only way ahead with UI Testing? Not necessarily but to make sure that your automated UI Testing efforts do not go in vain, it is essential to lay the right groundwork. In this blog, we talk about the best approach you can take to automate UI testing.
- Setting the right expectations:
To get your UI Test Automation plan rolling start by setting the right expectation, both with your team and your leadership. Since UI is a software development task, obviously it has a time impact. The leadership needs to be aware of the fact that some of the schedules and the delivery might be impacted while you evaluate tools to use, implement the tooling set up, get the team up to speed with the new tooling and then adjust your development process. While the initial set up does take a little additional time, there are some clear wins as well. You avoid wasting time on repetitive manual tests and also have clear and updates information on the system’s risk to the business value apart from having stronger faith in the automation safety net.
It is also essential to get the testing team involved in the initial testing set up process and ensure that the developers and testers work together to determine how the automation process has to be set up for work sets, decide where to place static or pattern based ID values, create backing API’s for setting up as well as tearing down test data etc. - Automate key business scenarios:
While 100% of the UI test cannot be, and indeed should not be, automated, certain parts of the test definitely can leverage automation. Most UI Test Automation cases fail not because of lack of execution knowledge but the lack of knowledge on ‘what’ to test. Since the UI Tests build several layers around the business domain code, breaking down these layers to automate them can be a Herculean task in itself. To test business rules through user interface normally require a host of smaller tests to be conducted with small workflow differences. However, test maintenance for such scenarios is harder especially when business rules change. Thus, it makes sense to not test the whole application through the UI. Having said this, automating key business scenarios and testing them end-to-end on almost a daily basis will ensure that the basic workflows are getting completed correctly without additional effort. - Tools Selection:
Along with everything else, selecting the right tools for automation also plays a crucial role in UI Test Automation success. Though an ill-fitting tools set might not essentially mean failure, it does involve spending copious amounts of time on setting up the automation suite, learning, writing and running the tests, fixing the broken tests and then again adapting the test to system changes. By getting the toolset right, you can actually focus on testing the system, provide better information to stakeholders and give your testing team more time to actually ‘test’ what they are supposed to and not waste your time in the mechanics of testing set up. There are some really great open source testing tools, such as Selenium that can help make your UI Test Automation effort a success.
Conclusion
The ability to find regression errors is one of the biggest advantages of automating UI testing. Since automated UI tests are supposed to ensure that the newly written code does not break or change the existing functionality, it works phenomenally well to spot regression errors and can easily become one of the best elements of your regression suite.
There’s still a lot of ground to be covered when it comes to UI Test Automation. Keep watching this space for more on what can be done.