Blog

Test automation essentials for a good start

Test automation is a software testing technique where you run your test automatically as a part of the quality assurance process. Automated software testing increases the scope of testing by executing repeated and complex designed tests automatically and as a result, it reduces workload and helps to improve product quality. It is very important to maintain your automation project so that it does not lose its value over time and become a burden for the team. I am going to share a few lessons I have learned in my five years of test automation journey in bonial.

1. Test automation should be team responsibility – not only QA’s

The process of building test automation is part of maintaining product quality which is a continuous process. It is teamwork and can be achieved only when effort comes from the whole team or the whole company. Building and maintaining test automation projects should be part of team responsibility.

I have seen in some places it is considered that developers will write unit test cases and QA will write UI or functional test cases. From my experience, if the test automation project is treated like that, it is very difficult to keep it UpToDate and maintain it for a long time. Test automation should be part of the main build process and can be written by both developers and QA. So that the whole team can take care of the project and get benefitted.

 

 

2. Select the automation tool which is familiar to your resources

Selecting incorrect tools or tools without proper training can lead to failure in your overall test automation project. Finding a tool that everybody feels comfortable which is very important. For developers to easily adapt and contribute as well as maintain the automation project, it is always better to use the same programming language as development. For example, if your resources are familiar with JavaScript and your application to be tested is also developed in JavaScript, it is more realistic to pick a tool with offers writing tests in JavaScript.

3. Make a proper test plan

Once you have selected your automation tool, you should not just automate a random test case. You should pick some set of test cases that are most beneficial. There is a quote from the book “Lessons Learned in Software Testing”-

“Automating without good test design may result in a lot of activity, but little value.”

 Remember a few things while building your first automated test suit

  • Make a proper plan for regression tests/ functional tests/unit tests, make sure you are not doing repetitive or redundant work.
  • Automate which tests are frequently required.
  • Automate which tests are complicated and time consuming to test manually.
  • Don’t add several functionality checks in one test case, rather write multiple smaller test cases.
  • Run your tests on a Random data set
  • Try to generate a detailed report, which is very useful to debug failed test cases. If possible as test results and also screenshot.

4. Test automation does not replace manual testing

We should not compare manual tests to automated tests. Rather consider automated tests as something which will extend your reach, help you to do things that you would not do with manual testing, and decrease repeating manual work.

Automated tests only do what you have implemented and tell it to do exactly in the same order and same speed. Manual tests allow you to explore different aspects from little to big. Manual tests are still very important. Test automation in combination with exploratory testing combines the best of both worlds.

Quality = Manual + automated testing

5. Do not expect 100% automation

Achieving 100% test automation is not possible in reality, and it should not be desirable too. There are some test cases not that much beneficial to automate. For example, checking the size, position, or color of a text box. It will cost more to write and maintain those kinds of automated tests than manual testing. Even if it is automated, it is difficult to get accurate test results. 

The right approach is to make a list of repeatedly executed test cases and to ensure the return of investment (ROI) of automating them. A mix of testing strategies including different types of automated tests and a minimum number of manual exploratory testing results in the best product quality.

 

6. Test flakiness

The automation project can be very frustrating and not trustworthy over time if the tests fail just because they are flaky. There are different approaches to handle flaky tests in your project. A very useful approach is to Retry or Rerun failed tests automatically. Multiple solutions are already available in the open-source community. Or you can write your own script to trigger rerun tests on failure. Writing scripts to Retry/Rerun failed tests are also very simple, you need to record failed Specs, trigger a job that will run the test suites only for those failed tests. You can also record statistics of flaky tests results.

Another approach to avoid flakiness is to design your test differently. Sometimes tests are flaky because of the way it is designed. So planning the test differently might solve the problem.

Conclusion

To build a successful Test Automation project – in other words to get proper benefit of automated tests, proper planning as well as defining appropriate strategy for maintenance is very important. Everybody related to the Test automation project should be aware of the fact that selection of proper tools and techniques will make this journey smooth and easier.

Author

 

This article was written by Konica Sarker, a Software Engineer at Bonial.