How to Write Automated Test Cases?

This post will briefly discuss how you can write good automated test cases using the 10 Golden Rules.

Automated testing is the future of software development. This also means that automation engineers are in high demand these days. Automation testing is a great career option for testers who want to stay updated with the ever-changing technology landscape. One thing testers should know about automated testing is that it takes more than just knowing Java or Python to do good automated testing. Here are 10 golden rules for writing better-automated test cases as a tester.

Golden Rules For Writing Best Automated Test Cases

Here are the 10 golden rules for writing better-automated test cases as a tester:

  1. Prioritize
  2. Test Strategy
  3. Automation Roadmap
  4. Test Case Design
  5. Test Case Execution
  6. Automation Framework
  7. Automation Environment
  8. Automation Execution
  9. Test Monitoring
  10. Automation Roll Out

Rule #1: “Prioritize Your Testing”

Automated testing should be your organization’s priority. If not, you are doing a disservice to yourself and everyone else in the development life cycle.  You need to keep this on your mind all the time so that you can talk about automated testing with anyone and everyone.

Rule #2: “Have a Test Strategy”

Automated testing will help you implement your test strategy rather than the other way around. Your test strategy should define what functionality you want to automate and how it impacts what you are doing in the organization.  This is similar to stating which areas of your application are more important than others.

Rule #3: “Have an automation roadmap”

You need to clearly understand how you will scale your automated testing efforts in the long run.  If you don’t know where you are going, likely, you will never reach your goal.  Here is a good idea for the roadmap:

Focus on Interfaces (API): Automated testing should be concerned with how interfaces are designed and implemented.  A good automated test plan will focus on core interfaces in your application and identify the APIs that cover them.  Write the test cases to cover these APIs and ensure your team follows your defined coding standards.

Deliver Fast, Test Fast: An automated test case should be able to confirm a business requirement within two weeks if possible. As an automation engineer, you must also deliver results and test fast.  If this happens, it will motivate everyone else in the organization to do the same.

Rule #4: “Design test cases for interoperability”

When your automated testing team starts designing test cases, you should focus on how an application interfaces with other applications/systems.  Not all of these systems need to run on different platforms, but they should be able to interface well with each other.

Rule #5: “Execute test cases as per the requirement.”

Don’t execute a test case if it covers a single business requirement. Break down your automated tests into smaller collections of requirements and execute them independently from the application point of view.

Rule #6: “Have a reusable framework”

You need to have a reusable automated testing framework in place. This will help you execute your test cases without any issues.  A common test automation framework will bring more developers and testers on board and make the whole life cycle easier, faster, and more efficient.

Rule #7: “Have a stable automation environment”

Your test case design should be independent of the environmental issues. For example, writing a test case to carry out drag-and-drop operations on an image should work flawlessly on desktop, tablet, and mobile devices (iOS/Android).

Rule #8: “Execute test cases in the right environment.”

A tester should not be in charge of executing automated tests. It is always better to have dedicated automation execution testers who will work with your team and execute their requirements.  This is because they need to ensure that the right test cases are being executed and that the underlying framework is stable.

Rule #9: “Monitor test results”

You need to monitor your automated tests at the project, team, and individual levels, too.

Project Level: You should know how many successful/failed test cases have been executed for a particular project. This will help you handle all the issues that may arise.   Team Level:  Monitor test execution at the team level to ensure no one is skipping an important test case. Individual Level: To streamline your team and improve reporting, you must monitor an individual’s performance on a day-to-day basis.

This will enable you to measure the effectiveness of an individual on different projects.

Rule #10: “Roll out automation with agility”

Automated testing should not be treated as a milestone, but rather, it should be thought of as an ongoing process. The rollout of test cases can be organized in a planned way.  You need to clearly define how an application roll-out should be carried out from the automation perspective.

The aim should be to automate as much as possible and leave the manual testing for exceptional circumstances. This will allow you to cover more business requirements quickly, saving time and money.

Automated testing is a continuous process, and the outcome of it depends on how professionally you design your test cases, how effectively you execute them, and how useful your monitoring is. As a tester or automation engineer, you must ensure everyone in your team performs better by creating an effective framework for automated testing.

Feel free to comment below if anyone can think of a better name for the above rules. I’m sure I’ll get more feedback and will update this post. Thanks!

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, or You can join me on Linkedin.

Leave a Comment