Introduction

  • Principles and best practices of good and maintainable test code
  • Avoiding test smells that hinder the comprehension and evolution of test code

You have probably noticed that once test infected, the number of JUnit tests a software development team writes and maintains can become significant. In practice, test code bases grow quickly. Moreover, we have observed that Lehman’s law of evolution, “Code tends to rot, unless one actively works against it” (1980), also applies to test code. A 2018 literature review by Garousi and Küçük shows that our body of knowledge about things that can go wrong with test code is already comprehensive.

As with production code, we must put extra effort into writing high-quality test code bases so they can be maintained and developed sustainably. I discuss two opposite perspectives of writing test code. First, we examine what constitutes good and maintainable test code, and best practices that can help you keep complexity under control. Then we look at what constitutes problematic test code. We focus on key test smells that hinder test code comprehension and evolution.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *