Smarter Test Automation: Part 2
Part II – Using the Automation Pyramid
- Start with writing unit tests as early as possible in the software development cycle.
- This will give you fast, stable tests and identify issues quickly without having to wait for the code to be deployed.
- For example, use unit tests to check the logic of a calculator application before you start developing the user interface.
- Leave the costliest and most time-consuming UI tests for where they’re more useful, at the point where UI interaction is required.
- For example, Selenium can be used to test whether a customer can create a new account, log in and go through checkout in an ecommerce site.
Despite the many benefits of using the Automation Pyramid as I’ve described it above, automation in and of itself is not necessarily beneficial in every development project. There are times when Manual or Functional Testing can be useful, either in part or for an entire project. By following the Automation Pyramid process, you’re not only making intelligent choices on how and when to use automation in your testing, but also working out where it might be better to apply Manual Testing.
The Automation Pyramid
Avoiding pyramid pitfalls
Many companies are still new to Test Automation, and with limited experience comes the danger of not always knowing the pitfalls. When it comes to any type of automation, these are some of the pitfalls you can and should avoid:
- The Inverted Pyramid. When inexperienced companies first hear about Test Automation, the first thing that comes to mind is usually ‘Selenium’. This can often lead to an ‘Inverted Pyramid’ situation where you end up doing unnecessary UI level testing first. UI tests are more expensive and take longer, so it doesn’t make a lot of sense to do it that way.
- Developing resistance. Let’s face it, not all teams are fond of writing unit tests. Test Automation is not a fully established discipline yet, and not all developers are keen to start writing their own tests.
- The wrong advice upfront. The Inverted Pyramid is usually the result of a lack of knowledge on the part of the business. If you get the wrong advice upfront, and aren’t very knowledgeable, you can easily be fooled into starting your testing journey with Selenium. It’s almost the ‘easy option’ but becomes difficult – and costly – to maintain.
- Know your coverage. Your test coverage is easy to measure through tools like static analysis and code coverage tools, so you can assess what percentage of written code is covered by unit tests. This is practically impossible with UI tests.
Choosing the right partner
There are very few applications where you can do only unit tests, and therefore always need to have some degree of API or UI automation. For most companies this means finding an experienced partner with the necessary skills to deliver the required services. But what should you look for in a testing partner?
- The right approach. When selecting a testing partner, keep in mind their approach to testing, and whether or not they follow the smarter way to test, using something like the Automation Pyramid approach.
- Skip the shortcuts. Don’t pick a partner that’s just going to jump into test automation and write UI tests for the sake of writing UI tests just because they’re easier, prettier or more relatable. We’re constantly looking at how to ‘push tests down’ at our client sites, using unit tests instead of UI tests wherever possible. At one of our large insurance clients we’ve written more than 8,000-unit tests over the past couple of months, whereas they had no unit tests at all before that.
- Upskill your staff. Find a partner that has the resources to upskill your staff. The Inspired Testing Academy takes the people who predominantly sit outside the scope of Test Automation – like manual testers – and gives them the skills to automate.
By avoiding the pitfalls of using the Automation Pyramid incorrectly, and finding a trusted partner than can help guide you through the process while upskilling your staff to write their own automation scripts, you’ll be well on your way to reaping the rewards of smarter test automation for your business.