[Book review] Unit Testing — Principles, Practices and Patterns

Alberto de Blas
1 min readMay 20, 2021

This book has been a truly hidden gem for me.

I have learned a lot reading it and I have realized about bad practices that I was falling into. As well I feel I have really understood why some practices are good and are preferable over others.

Also reading this book you receive as a bonus knowledge about hexagonal and functional architectures. Surely this are topics which require a broader presentation but this book gives a nice and clear introduction.

The code examples of the book are written in C# but for me, that I am used to read Java and Python code, are very understandable.

My key takeaways are:

  • Differences between classical and London styles
  • Framework to evaluate a unit test
    - Resistance to refactoring
    - Protection against regressions
    - Fast feedback
    - Maintainability
  • Test code with domain significance or work coordination
  • Mock only out of process dependencies
  • Do not share production and testing code (for instance constants)

Really, really recommended book.

--

--