7 Ways to Better Test Automation
7 Ways to Better Test Automation
By a wide margin, testers produce the most defect-prone code I see.
Make sure to test your test code. Shouldn’t test code be the best code? It’s responsible for alerting us to whether other code is correct, so it must be consistent and robust.
2) Write test automation for intent
I ask my clients “what are you trying to achieve with this automation?” Many times the reasons for automated testing aren’t discussed or vetted with peers or managers. I’m not saying people need to discuss every line of code. And certainly, there are people who can handle discretion as to what they automate. But, often the intention of what we’re doing gets lost in the details of implementation.
Know the “why” of your automation. Many times, when we’re pushed to describe why we’re doing something solutions get easier and better.
Describe your intentions. Write test code that executes your intention.
3) Broaden your user base
Once your test code works consistently, get more users. One of the biggest multipliers in automation is its ability to be used more than once with no additional effort. The next multiplier is when more people use it.
Can a developer use your automation to troubleshoot or debug a defect? Do stakeholders run or watch your tests to see if their requests are fulfilled? Can your automation run on different machines to show you what works on one system and not another?
If others aren’t using your automation, get their feedback, learn why.
4) Do something tedious with ease
If you can easily automate a task that for a human is tedious, do it. Many times elimination of mistakes humans would otherwise make is worth the effort. Sometimes this is in the form of tests that are tedious, sometimes it is code near or around automated tests (think deployment, orchestration, preparation steps, or implementing regulatory requirements).
5) Easily automate something that takes a long time to do manually
As far as automated tests go, this is perhaps the most obvious. But there are many processes we do that could be automated aside from just tests.
Once you get proficient with your testing tools and build out some code, you may start to see where it gets easier to do certain types of tests or automation. When that’s the case, use it to replace long tasks & tests. Save people time and energy with your automation – especially when it’s easy to create.
6) Help the team understand the SUT
Often we focus on validating that a product works as intended. But many times our test automation helps us understand what the SUT is doing. Use that. Know when the SUT changes. Know what changed because you automation reports to you succinctly and clearly.
7) Learn the craft of coding
Most good automated testing requires coding. If you’re coding test cases, learn the craft of coding. People spend years honing the craft. Figure out who those people are and learn from them – pairing, reading their books, listening to them on podcasts, talking with them – learn the craft of coding.
Do projects on your own time. Create applications outside of work, that will teach you the other side of software development (construction) as well as how to write better code when you automate. It doesn’t matter if the project is viable or a good idea. It matters that you do it and you learn from it.
Image credit to Hannah Wei, used with permission from unsplash.com.