How to create clean test code
As test engineers, how often have we proclaimed that test automation code is real code– and should be treated like any other development project?
I say it all the time.
Since test automation code is development code, it should adhere to the same standards –code reviews and the like–just like any other development effort.
Cory House, author of the Pluralsight course Clean Code: Writing Code for Humans, shares with us his top tips for creating readable, easy to maintain test automation code.
About Cory House
Cory is founder of Bitnative LLC, an agile software development and training consultancy, and creator of OutlierDeveloper.com, a community for software developers who aspire to be exceptional. He is a Pluralsight author, INETA speaker, independent consultant, and blogger with 15 years experience in full-stack software development.
Quotes & Insights from this Test Talk
- Imagine no one could come and speak to you again, Imagine people can’t read any of your comments, and imagine that there is no documentation that they can go lean on to find out what you are trying to do. So all they have to read is your literal code. If you can convey your intent just with the code, then you are writing self documenting code
- If you get confused reading your own code, obviously any other readers is really going to be in trouble
- Write your tests code as if you are an author
- The way you name you methods and classes help make test code to be more maintainable
- Pair programming should be done when writing test automation code
- There’s no problem so simple that a bad test automation developer can make complicated
My “rubber duck” :
Cory's Online Courses:
- Clean Code: Writing Code for Humans
- Becoming an Outlier: Reprogramming the Developer Mind
- Architecting Applications for the Real World in .NET
Connect with Cory
- Twitter: @housecor
- Cory's Blog: bitnative.com and outlierdeveloper.com
May I Ask You For a Favor?
Thanks again for listening to the show. If it has helped you in any way, shape or form, please share it using the social media buttons you see on the page.
Additionally, reviews for the podcast on iTunes are extremely helpful and greatly appreciated! They do matter in the rankings of the show and I read each and every one of them.