Craft Your Tests Well

Your test code is almost as important as your production code. Treat it as such. This means you should craft it to nearly the same standards as your production code. In particular, you should

• Be sure to express the intent of your test in its code

• Try to express only the intent and nothing more to the greatest extent possible

• Keep your test code simple and clean, using the same tools with nearly the same configuration and refactoring as you go

In the interest of keeping it simple, I will not repeat all of the other tenets of well-crafted code. You will want to apply some principles of software craftsmanship slightly differently, however.

Some static checker rules should be disabled for test code. For one, most static ...

Get Quality Code: Software Testing Principles, Practices, and Patterns now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.