15 Best Practices and Strategies for Test Automation in 2019

You might be wondering:

How professional Automation experts manage Test automation, What all are the Practices & Strategies that they follow for a great Test Automation framework to survive in long term without any hurdles?

In this blog,

I am going to reveal, some mandatory strategies to keep in mind while performing Test Automation on your project.

These are the exact points/checklist that I have consolidated from Software Testing Veterans or gurus Michael Bolton, James Bach and Cem Kaner and my own past experience of 5+ years.

Are you excited?

Say Yes…

Let’s Start.

Maybe, You are going to start the Test Automation project in your company but you are not confirmed what all are the best practices for Test Automation?

Choose the Right Test Automation Tool for Start.

You should go with the AutoIT Tool.

Make sure you are clear with the advantages or disadvantages of that tool that you are going to use in Test Automation.

Do some POC and figure out early if it is handling your requirements or not.

“If there was one weapon he had against these savages, it was not acknowledging their existence.”
― Melina Marchetta, Finnikin of the Rock

Knowledge about the Other Test Automation tools and their pros and cons is must and You should avoid these naive mistakes while choosing Right tool for Automation.

  • Research about the Automation Tool before Selecting
  • Do some Proof of concepts and fail fast.
  • let the team know about limitations of Automation Tool.

Sometimes by losing a battle you find a new way to win the war. — Donald Trump

Use Design patterns in Test Automation for the God sake

“Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live”― John Woods

Click to Tweet

In the Test automation,

It is mandatory to code using well practices and pattern so that people can understand your code with minimum efforts.

“I’m not a great programmer; I’m just a good programmer with great habits.”
― Kent Beck

So you need to develop the good habits, and what are all Good habits in Test automation?

Design Patterns

Learn to use Page Object Pattern if you have working with the Selenium.

Never ever code in Spaghetti pattern where every test cases is tightly coupled with the Other Test case.

People have a hard time understanding these kinds of patterns and it will lead a bad impression on your colleges or senior resources.

My favorite quote about coding it that -

“Truth can only be found in one place: the code.”

Robert C. Martin

You Can’t ignore the Naming convention

Use below Rules to choose the Name of the variable.

  • Use camelCase.
  • Avoid no meaning variables names
  • Avoid keywords as variables names.
  • If possible use a format for the variable name.

4

Extensive use of the parameters and Data-driven Testing.

Do frequent refactoring whenever required for your test cases.

For your Test automation to succeed it is mandatory to refactor your code time to time

Implement Logs, screenshot, Reports like Professional.

Create custom wrappers for the utils or selenium methods for ease.

These wrappers may not make sense for everyone or are not generic but they are very helpful for your project and hence makes your test automation great.

For example

We have created Custom wrapper or function to scrollTo X,Y position with the element, This kind of function is used by our Test Cases many times.

It is created as a custom wrapper using the selenium internal methods.

Stabilizing the Tests — The Hard Part

We need to make sure that the test cases should be stable as much as possible.

If they are the flaky test, We should move them to a different test suite.

Create unique & Meaningful — Test data

I have noticed that testers use some random data and due to that their test automation are not able to find bugs and so avoid this mistake.

Use Behaviour Driven Development whenever possible

With the increased popularity of Cucumber(A famous BDD tool).

People are now moving to BDD framework for Test automation,

Where Test cases of in Test automation framework are written like normal language(like Given this then that) rather than complex structured programming code.

Include Alerts,Email Reports of Failure and flaky Test cases.

This can be email or alert with Test report or a Report containing the number of Test cases failed per week/daily extra.

Avoid — Hardcoding input data or values.

I have seen people have hardcoded the passwords of the production server in the Automation framework or admin accounts credentials in the source code.

Please avoid this silly mistake.

Assign Default values

Not assigning default value is bad code practice and i have seen lots of Automation Test Cases failing due to the null checks extra due to this.

Use the Dry principle

Fail Fast and Do POC first.

Conclusion

What do you thing?

Now I’d like to hear from you.

Maybe you have a question about something.

Or

Want to Share Your Awesome Strategy of Test Automation.

Either way, let me know by leaving a comment below right now.

Learn Automation

Learn about the Software Testing and Test automation in Discussion.

Join My Facebook Group

Recommend Book of Post

Lessons Learned in Software Testing: A Context-Driven Approach

Buy Now!

Originally published at https://scrolltest.com/2019/01/05/best-practices-test-automation/

Lead Automation Expert | Blogger |Health Enthusiast https://www.youtube.com/c/thetestingacademy