logo logo

Automation Testing Best Practices & Strategy

Automation Testing Best Practices & Strategy

I thought it would be a good start to the blog by giving you some information on what really automation testing is. Automation testing is a type of functional testing technique, that uses automated testing tools and frameworks to execute a test or suite of tests. Think of automation testing the contrary of Manual testing. This type of testing demands considerable effort, resources and investment of money… However, it saves you a bunch of time with rigorous and repetitive manual testing.

Some of the test automation benefits include:

  • Reduces time
  • Reduces efforts
  • Increases productivity
  • Increases predictability
  • Increases reliability

In this blog, I will walk you through automation testing best practices and the vital areas to think about when creating a test automation strategy.

Testing Pyramid
https://martinfowler.com/bliki/TestPyramid.html

When to do it? ⌛

This is a very interesting question, when do we automate test cases and how do we know we have the right details to start automating?

First of all, identify opportunities within automation. I would suggest as a team to first decide what test cases are worth automating. Once these are selected, you can work on what tools work best for the project to support automated tests. It would be a good practice to then divide the automated testing efforts. You can also create a golden data set/synthetic data to use for the automated scenarios and create tests that are resistant to changes in your product UI for instance.

There is no specific time when you can automate tests. I think what’s more important is what team support we have, the tooling and strategies to have a good and complete automation test suite. Some teams prefer being more established with their product before even thinking of automating tests, however some teams have enough information to start automation testing from an early stage of a product.

Automation Testing Best Practices 👩‍💻

It is always a good idea to follow good practices when automating your tests. Remember one thing, you cannot automate everything, as certain aspects of your product require human validation/acceptance, intermittent tests where we are not sure of the end result, usability testing and even exploratory testing. Also automating every test leads to an increase of cost, effort, and time than is practical.

  • In order to produce good, automated tests, know the application being tested.
  • Prioritize scenarios, you can decide in the team what are the useful user flows in your product. Divide your scenarios into high-value and cost-benefit of having it automated. Follow the process stated below to help your team.
  • Select an automation tool that fits your resources & requirements.
  • Have a good code review session, sometimes when developers review the automated tests, they can revert back with some good feedback which may help the engineer for their next test.
  • Make sure tool/ packages are upgraded accordingly too, leaving this too late can make a tester’s task difficult by correcting flaky tests and creates unwanted noise.
  • Try and work with a tool that has a good and open community, so if you have any questions, they can get answered and this way also helps you scale your tests.
  • Make sure your script is written in a way that is reusable code, and can be used for other test cases too.
  • Plan for unexpected events (negative testing).
  • Atomic flows, start by breaking your test code into small chunks and simple tests once all completed, put them all in one scenario and make sure the performance has not changed.
  • Reduce the number of occurrence conditions. In order to ensure the test is predictable and easy to manage, try to avoid if-statements when writing a script.
  • Write isolated scripts. Running self-contained flows improves the quality of parallel testing. As opposed to connected suites, if there’s a hold up with an independent test, the entire session will not be affected.
  • Custom data test attributes- Every test you write will include selectors for elements. To save yourself a lot of headaches, you should write selectors that are resilient to changes.
  • Make sure every test is using a number of scripts and every script is being used by a number of tests to allow automation a long life.

In a nutshell, start your test suite small and slowly grow, assure that they are robust enough to be executed in parallel and unattended.

Creating an automation test strategy & where to start from? 💫

Automated tests are generally introduced into a project to solve issues such as repetitive manual work, working with large data sets, or getting faster feedback in a CI/CD pipeline. Therefore, in order to have better ROI, test coverage and increases test reliability, you should create a test automation strategy. Within this strategy, you can have all the nitty-gritty details from what tools to use, what tests to automate and what resources to use.

A test automation strategy supports you in implementing test automation in a way that is repeatable. You need to have certain details in order to have a complete strategy, such as what is your goal for automating tests, who will be the main team working on this? When and where the testing will take place? Mainly, what you will be automating.

Some areas you must have in your strategy document to cover how automation will take place can be:

  • Tools and frameworks that could be useful (including the pros and cons)
  • An upgrade strategy for the tools
  • What environments to use when automating tests
  • Test parallelization
  • What test data is available to use/ need new data set
  • Branching strategy
  • Browser compatibility
  • Test architecture, helps to see what it could look like
  • Best practices
  • Tips of where to start the automation test
  • What to automate
  • Code review process

Depending on every team/project, your strategy would be a little bit different. That’s the beauty, you can add the details that matter the most within your team and support your product.

Personal opinion 😊

I started my testing journey as a manual tester and automation testing was not much around. But slowly in my career there came a day where the test team decided to completely switch to automation and that’s where my automation journey started. I was quite new to the tools and the coding side of things. I did understand the benefits, but it was quite tricky to go from a manual tester to an automation tester full time.

All in all, I quite enjoyed the experience as I learned everything from scratch: test frameworks, tooling, scripting and testing scenarios. I believe it is not a requirement for all testers to know how to automate. However, it’s important to have knowledge around automation strategies, how this can be brought to the team and what can and should be automated. A tester can work alongside a test automation engineer as a guide. Remember not everything can be automated. Predictions should be made, suggestions, refinement, collaboration, or even the look/feel/opinion of a user interface.

Conclusion 🔚

While working on test automation, creating strategies and learning its techniques, I indeed found new and interesting challenges to solve. I also thank the developers that supported me throughout this new journey. Automated testing is an effective solution that continues to improve testing as a whole. It can and does certainly save time and cost, if executed correctly. Repetitive tasks take a long time and if conducted by a human tester, could lead to human errors.

Automating these processes can increase accuracy and speed of release. However, you still need human intervention to write test cases, and many types of testing, like exploratory testing, can’t truly be automated at all. Relying on 100% automated testing is a sure-fire way to miss bugs you should’ve caught.

Laveena Ramchandani

About the author

Laveena Ramchandani

The Tech world is ever growing and I have been working in Tech for over 7 years now. I work in testing and quality assurance, a good mix of technical and business awareness role. I have learned a lot through my career and look forward to gaining more knowledge and at the same time inspire and spread more Testing eminence around the world.

Join TestProject Community

Get full access to the world's first cloud-based, open source friendly testing community. Enjoy TestProject's end-to-end test automation Platform, Forum, Blog and Docs - All for FREE.

Join Us Now  

Leave a Reply

popup image

Become a master for Selenium testing

Getting started with web testing? We’ve got you covered with a FREE ready-to-go test automation platform that’s already bundled up with Selenium to simplifying and enhancing your experience.
Get Started
FacebookLinkedInTwitterEmail