View all web browser and mobile devices available in our cloud-based test lab.
Test automation best practices are key to success in DevOps. And the building blocks of fully functional test automation are the automated test cases.
Here, we cover our top test automation best practices — and dive into tips on how to use automated test cases.
Here are 7 best practices for test automation.
We believe that the key to test automation is to:
Once you've achieved that, invest more and grow the automated test suite.
You want to have some objectives in mind before you decide what to automate. It’s highly important that your testing stakeholders run through questions with a focus on value and context.
What value do we want to add by automating? What defects do we want to find and prevent? What areas of testing are highly critical to customer satisfaction?
Use your own business and departmental experience to establish your test objectives, so that at the end you experience meaningful results that the entire business can see. Keep in mind that such objectives must be tuned as the product lifecycle evolves to ensure the directions and focus are still relevant.
Not everything that is automated needs to be part of your job or part of your CI. If a test is not important to CI in the long term, it will waste precious time to monitor and fix when in reality you simply don't need to fix the issue.
The bottom line is that you want to focus your time only on the important tests, so be very diligent in defining those tests that become part of your suite.
We are in a digital age, so everything runs on mobile platforms like smartphones, tablets, foldable smartphones, and desktop browsers.
You want to think with scale in mind when developing new test automation or even maintaining existing automation.
The time to develop and maintain a test is absolutely crucial. While you may have created a sophisticated test, if it was a time-consuming endeavor, it’s not realistic to use long term. You must balance the test creation effort with the overall resources you have available to keep automation running. This is true test automation scalability.
In addition, test code MUST be treated as your production code to ensure it is backed up, has history, can be maintained and fixed easily, and more.
Automated testing is also about test coverage.
First is platform coverage, which includes smartphones, browsers, and operating systems that should be covered when parallel testing. The other facet of coverage is test scenarios, which include the business flows in the product. Ideally, coverage encompasses the product and application scenarios that are critical for every single test cycle.
As an organization, you should know the level of coverage you currently achieve, and with test automation in place, your coverage should be extended. Keep monitoring your coverage to know whether automation is achieving a lift.
Additionally, something that people tend to neglect is the early warnings. When you are creating test automation for the first time, there will be important early warnings that convey test flakiness, inconsistent results when running against different platforms, latencies, and synchronization issues.
Keep early warnings in mind and when you see a test that is error-prone, keep an eye on the test. One way to address test flakiness is through test reporting, by adding relevant annotations and tags that can be filtered and examined.
Automate faster with Perfecto. Start your free trial today.
Every organization is unique, especially when it comes to the individual team members and their skillsets. When it comes to automated test cases, your team personas will have a major impact.
Here are the three business personas that contribute to the testing life cycle:
When you have your automated test case plan set and your team in place, you can finally decide which test cases to automate.
The decision-making process starts with a test engineer’s gut instinct which is based on experience and test creation talent.
Teams should also pay attention to the risk associated with a test and a defect. A test engineer will have a process for calculating the risk as a probability that an issue will occur and how it would impact customers.
The value should always be a huge part of the automated test case development process. Testers should consider whether a test case will provide new information. If a test case were to fail, how long would a fix take?
Return on investment is key when getting your automated test cases off the ground. If too much time is spent on test case creation, the value will quickly diminish. Keep in mind the pace with which you create your tests and how easy they are to script.
When thinking of creating a test case for a feature or functionality, weigh the volume of historical failures and frequency of breaks for the feature or function. If it is a highly sensitive or volatile area to test, it may not be a good candidate for test case creation.
It’s one thing to create valuable test cases from the beginning. However, writing test cases with longevity is the ultimate payoff. When creating test cases, it’s important to think about the impact of time.
Think about the future of the web or mobile applications. What changes are in the roadmap? Will the test case be compatible with those additional iterations?
Think about the organization and its evolution. Will the organization have the resources available long-term to support the test cases you create today?
Another consideration is how technology will change. Every few weeks you see a new device and a new operating system. Do your test cases match the technology, OS, and devices of today, as well as the technology that’s to come? For example, do you have test cases prepared for the eventual takeover of 5G vs 4G?
While it’s impossible to predict the future, spending time reviewing the possibilities of what’s to come for your software development organization will help.
Test case maintenance is as important as test case creation. Consider all variables including the business personas on your team, the organizational roadmap, and tech changes on the way.
If you’ve followed the guidelines in this article, your test cases should be well designed and prepared for scaled automation. At this point, you will be running many tests and gaining significant test case data.
This data is how you can discern if your test cases are really successful. Measuring test case value is the final piece of test case best practices. There are several elements to measuring the value of your test cases.
An important test case measurement is DRE, or defect removal efficiency, which is a metric used in the software testing industry. DRE defines how well test automation performs in removing defects introduced to a software application.
The DRE equation is DRE = Ratio between the total defects found prior to app release to production /total defects introduced later in the cycle (Production/UAT))
A good DRE metric includes a minimal number of defects in the denominator, with higher number in the nominator field. When this occurs, “shifting left” is in progress. Ultimately, through monitoring the DRE and identifying defects prior to the release of the product, better overall test automation is achieved.
While each group will build out their process of measuring DRE, the key is to keep it formalized and ongoing. Establish a baseline DRE so your team can work to improve upon your average DRE every cycle. Periodically review the number and make changes accordingly.
Remember, it’s important to keep an eye out for test automation success metrics as well as failures. Check out this post for more: 4 Signs Your Automation Is Failing You.
To get your team started, these are some recommended points of test case analysis. These KPIs all shed valuable insight on your test automation success.
While the process of test creation according to industry best practices can seem daunting, we hope this blog gave you a step-by-step path to get started.
Remember, each team has its own unique strengths, skills, and testing personas. Take time to assess your existing resources and software development processes and begin to create test cases according to these best practices.
Soon your test automation will be running with success, saving your team time, and helping you deliver best-in-class applications.
From test case creation to measurement, the process of implementing automated testing is essential to successful DevOps. Perfecto makes test authoring, maintenance, management, and measurement a seamless experience for your team.
With the Perfecto platform, your enterprise can expertly navigate and automate advanced test scenarios. Plus, we integrate with your existing testing frameworks including Selenium, Espresso, and Appium.
If you’d like to explore how Perfecto can help you build a cutting-edge automation process that gives maximum coverage and scale, sign up for a free trial today.
Start My Trial
DevOps Chief Evangelist & Sr. Director at Perforce Software, Perfecto
Eran Kinsbruner is a person overflowing with ideas and inspiration, beyond that, he makes them happen. He is a best-selling author, continuous-testing and DevOps thought-leader, patent-holding inventor (test exclusion automated mechanisms for mobile J2ME testing), international speaker, and blogger.
With a background of over 20 years of experience in development and testing, Eran empowers clients to create products that their customers love, igniting real results for their companies.