Must Read: Unit Testing: Principles, Practices and Patterns

In the book's opening, the author thoroughly describes concepts familiar to the developer community: Unit Testing, Code Coverage, the Testing Pyramid, and more. However, beneath these familiar definitions often lie numerous misconceptions that can distort their intended meanings. The author meticulously addresses these misconceptions, explaining why each is incorrect. For instance, Code Coverage doesn't necessarily indicate where your code is covered by tests, and Mocks are not just libraries but a set of tools referred to as "substitutes."

The author delves into a delicate topic: the rivalry between two testing schools - the London School and the Classical School. He breaks down their similarities and differences, ultimately convincing readers that the fundamental distinction is not in the testing approaches per se but in the definition of what constitutes a "Unit" for testing. For proponents of the London school, it's a class; for the Classical adherents, it's a business scenario.

However, the book's main value lies in the author's perspective on the purpose of unit tests. Instead of the commonplace belief that "tests should defend code against bugs," Vladimir suggests four attributes of quality unit tests:

  • Defense against bugs
  • Resilience to refactoring
  • Fast feedback
  • Ease of maintenance.

By evaluating the different testing school approaches based on these attributes, the author attempts to settle the longstanding debate over which approach is more valid.

Moreover, the book offers a plethora of practical tips on writing unit tests, from proper naming conventions to advice on using mocks (also known as doubles) and crafting complex end-to-end tests.

This book is essential reading for any developer. It not only significantly improves one's skills in writing unit tests but also provides compelling arguments to guide an entire developer team toward the most effective approach to testing.