Most DevOps teams know why they should automate testing. For many organizations, the bigger question is how. A number of obstacles tend to make it difficult to make the jump to automated testing, or to expand upon automated testing procedures that are already in place.
Let’s take a look at some of the most common hurdles that DevOps teams have to overcome in order to begin test automation and start leveraging the benefits that automated tests provide.
Deciding Which Framework to Use
There is no shortage of software frameworks available for test automation. Deciding which one to use (or mistakenly assuming that you have to pick one and just one) can make it intimidating to start automating your tests.
Selenium is the industry standard for automated testing, and almost certainly the most widely used framework. It’s a good place to start if you need to automate tests across a variety of browser and operating system combinations.
However, Selenium doesn’t support all types of testing scenarios. If you are doing mobile testing, you’ll probably want to use Selenium’s cousins Appium and Selendroid. And you might want to complement those frameworks with UI testing tools like XCUITest for iOS and Espresso for Mocha.
Keep in mind, too, that you by no means need to choose just one automated testing framework. You can (and probably should) have multiple frameworks in your arsenal, as some frameworks lend themselves better than others to certain use cases.
Knowing Which Tests to Automate First
It can also be intimidating to decide which tests to automate first.
This is an important issue to address. For most organizations, it is not feasible to start automating all tests at the same time. (Plus, even the organizations that make the very most of automated testing usually do manual tests occasionally.)
So, where do you start? In most cases, it makes sense to look for tests that take the greatest amount of time to perform manually and are also the easiest to automate. Integration testing and UAT tests usually are good choices.
You’ll also get the biggest payoff by automating the tests that you run most frequently. Rather than spending time writing automation scripts for a test that you only run once a week, focus on automating the tests that you run daily.
Once you have automated these tests, you can invest the time that they save you in automating less frequent tests, as well as those that are harder to automate.
Lack of Test Infrastructure
You need somewhere to run your automated tests. If you’re only automating a handful of tests, you might be able to get away with executing them in an ad hoc local environment. But when it comes time to scale up your automated testing routine, you’ll want dedicated testing infrastructure.
One way to obtain test infrastructure is to build an on-premises test grid. If you’re new to automated testing, however (and if you lack the budget to invest in the hardware you need to set up a test grid), this may not be the best use of time and resources.
An alternative is to use a cloud-based test grid, like the one provided by Sauce Labs. Cloud-based testing allows you to avoid having to set up or maintain your own testing hardware and software. (You could also try setting up a test environment on a generic public cloud, but doing so still requires a lot of expertise in installing and configuring test software; it’s probably not worth your time to try this approach.)
Lack of Automation Expertise
You may be unsure where to start with test automation because no one on your team has worked extensively with automated testing before.
This is an obvious challenge. Fortunately, however, opportunities abound for educating yourself about test automation frameworks and best practices. Most of the most popular automated testing frameworks are open source and thoroughly documented. You can teach yourself to use them easily enough.
And if you want more formal or interactive training, you can find plenty of online as well as in-person classes dedicated to tools like Selenium. You can also take advantage of webinars devoted to the mechanics of automated testing, like this one.
You are a Perfectionist
You might be struggling to automate your tests because you don’t have a lot of prior experience with automated testing, and you worry that your tests will not be perfect.
The fact is, however, that you don’t need to be able to write the best automated tests in the world in order to reap the benefits of automated testing. Even if you make mistakes at first, or fail to follow best practices, your automated tests will still save you a lot of time and allow you to test much more comprehensively than you can when relying on manual testing alone.
An automated test that has some inefficiencies or does not run quite as fast as it could if it were written by a seasoned automation expert is still going to deliver a lot more value to you than its manual equivalent.
Taking the first steps toward automated testing, or expanding upon existing automated tests, requires some investment of time and resources. But the hurdles are easier to overcome than you may think. There are plenty of readily available testing frameworks, as well as cloud-based testing infrastructure and educational materials that can help any DevOps team to make the most of automated testing.
Chris Tozzi has worked as a journalist and Linux systems administrator. He has particular interests in open source, agile infrastructure and networking. He is Senior Editor of content and a DevOps Analyst at Fixate IO. His latest book, For Fun and Profit: A History of the Free and Open Source Software Revolution, was published in 2017.