Test Automation Best Practices

Test Automation Best Practices: Regression testing (automation testing) is so important when a new feature is developed for an application, QA team tries to execute different scenarios to bring to light any possible flaws present in the existing codebase. Because the inclusion of a new feature can also hamper the integrity of the existing functionalities.

But manually testing every minute feature of an application on a regular basis is not only an expensive affair but also impractical. And this is why automation testing is made part of every project especially in the agile project where testing plays an important role.

Test Automation Best Practices

To automate an application, all the QA team requires is basic coding skill and a list of test cases that need to be automated. But should automation testing be solely driven by QA team’s technical expertise and available test cases? The answer is NO.

Automation testing, if not planned properly can do more bad than good. In this article, we would discuss the different pointers that every QA team should keep in mind while aiming towards automation testing of the application.

Automation Testing at a Glance

Incorporating automation testing in the project not only reduces testing efforts but also provides valuable time which can be utilized in other QA processes.

The following points enlist what a tester should look out for while starting with automation testing.

Figuring out which test cases Need to be Automated

  • Every application depending on its complexity can have numerous test cases. But all of these test cases can’t be automated.
  • The test cases which are of less importance or are used rarely in the application can be kept aside and covered as part of manual testing.
  • The tests that handle validation and comparison of big lists of data should be considered for automation.
  • For example, price filter in e-commerce applications displays products within the mentioned price range. As the huge volume of products can come under any selected range, verifying the price of each and every commodity is not logical. For this reason, verification of valid filter responses should be automated.
  • Test cases that require a lot of time and effort to execute should also be converted into automation scripts.

Using the Right Automation Tool

  • Automation testing tool that is used in a project, decides how stable and valuable the upcoming scripts would be.
  • There are a lot of different automation tools available in the market, and the number is rising each day. Each of these tools possesses a flavor of their own and provides a distinct advantage over the other. But in spite of the availability of such wide variety of tool, QA team should choose the one that perfectly suits their needs.
  • If an automation testing tool is randomly selected, it can have disastrous consequences. Impulsively selecting an automation testing tool can not only create hurdles within short intervals but can even prove to be a roadblock for application automation in the near future.
  • Under any circumstances, the selection of the automation tool should be dependent on the application that needs to be automated and the preference of the QA team. Some of the criteria for selection are:
    • Technology dependence– While selecting the automation testing tool, the application’s technology and platform need to be kept in mind. Is it a .Net or Java application? Such questions need to be answered first, in order to find out the application scope that needs to be covered.
    • O.S and platform – Is this a web, mobile or hybrid application? This answer can further aid in narrowing down the right tool for automation testing. In the case of mobile applications, depending on the platform, Android, Windows or iOS, the tool should be selected.
    • Technical skill in the team – If QA team members lack programming expertise, a tool should be used which is easy to use and doesn’t require much coding to create scripts. Under such scenarios, keyword driven testing frameworks would be the right option.

Repetitive Testing

  • Using automation testing tools, tests can be executed without the need of much manual intervention. So to reap the most benefit, these tests should be run frequently.
  • This will not only keep the application stable but can also prompt the QA team at an early stage if any major issues are encountered. Such early detected issues are easier and a lot cheaper to fix than at a later stage, when the build is moved to production.
  • As all the automated tests can’t be built overnight, it should be considered as an incremental process. For example, once a single automation testing script is created it should be run at least daily. With each passing day, as new scripts are created they should also be added to the group of executable tests.
  • Web applications are generally accessed using different browsers. Every application has a list of favorite browsers. As manually testing each and every feature of the application on different browsers is a cumbersome task, such scenarios should be automated on different browsers, to validate the application’s browser compatibility.

Utilization of Testing Resources

  • Time of every testing resource is precious. So, automation testing tasks should be assigned in such a fashion that, effective and quality scripts are efficiently created in short durations.
  • If few team members of the QA team have better programming knowledge, they should be involved in creating the automation testing scripts. While other testers can be involved in fabricating the test cases.
  • Once a couple of test cases are automated, the members who were writing the test cases can go through the code and take the help of the other team members to understand the logic behind the code.
  • As the number of automation testing increases, so will the knowledge transfer, and gradually most of the QA team would have a decent understanding of the coding practice to follow while creating such scripts.

Creating Quality Test Data

  • Most automation deal with data inputs from the users. In order to successfully automate such applications, choosing the right set of test data is very important.
  • The test data that are used to automate different scenarios should closely resemble the data used by clients after each release or by dummy users during user acceptance testing.
  • Such test data should be requested from the client in order to add further value to the automated tests.
  • If getting such data from the client is not a viable option, external data should be used from different sources. Different inputs for each field can be mapped in an external excel sheet, which in turn would be utilized by the automation script.
  • Such practice would create well-structured data and help test each field against different sets of data. The sooner such test data is created, the better.

UI Independent Automation Testing

  • In almost every project, one or the other UI component is affected due to changes made in every build. Such changes not only make the automation script unstable but also call for maintenance.
  • If a project has short release cycles, UI dependent automation scripts can be majorly affected, and fixing them can require ample QA effort. The best bet is to focus on automation scripts that don’t rely on the application’s UI.
  • Testing the database entries and the application’s interaction with the back-end through automation is one such way. If the application used any APIs, the response can be validated against a set of requests.

Proper Automation Planning

  • When the QA team has selected the automation tool, they should start creating a test plan for automation.
  • Even though automation adds a lot of value and improves the testing efficiency of the project, if not planned well, automated tests would not be beneficial.
  • The project goals should be kept in mind while planning the automation scripts.
  • As shown above, a value vs effort graph can be really helpful to find out the tests that need to be automated first.
  • The graph shows two curves. The tip of the red curve depicts the automation scripts which has high value and takes less effort to create, and the end signifies the scripts that have low value and high effort.
  • In the case of the green curve, it’s starting point shows the script which has less value and takes less effort, while the end of the curve shows the tests which would take a considerable amount of effort to automate, but would be of high value.
  • Once the value and effort required to create automation testing scripts are figured out, the high value, low effort scripts should be automated first. This will ensure that the major functionalities are automated and tested often from an early stage.

Conclusion

  • The right automation testing tool should be selected after considering the technology and platform the application works on.
  • Only those tests should be considered for automation testing that adds value to the project and reduces manual efforts.
  • All automation tests must be run daily, in order to trace issues at the earliest.
  • QA team should properly plan the automation testing tasks among team members and prioritize tests that need to be automated.

I love open-source technologies and am very passionate about software development. I like to share my knowledge with others, especially on technology that's why I have given all the examples as simple as possible to understand for beginners. All the code posted on my blog is developed, compiled, and tested in my development environment. If you find any mistakes or bugs, Please drop an email to softwaretestingo.com@gmail.com, or You can join me on Linkedin.

Leave a Comment