Unit Testing book

From the author

I come from a mathematical background and strongly believe that guidelines in programming, like theorems in math, should be derived from first principles. I've tried to structure this book in a similar way: start with a blank slate by not jumping to conclusions or throwing around unsubstantiated claims, and gradually build my case from the ground up.

I intended this book as the complete guide to unit testing: a practical, start-to-finish blueprint for approaching the subject.

Get a 40% discount

What software developers are saying

Just finished reading the book. It arrived three days ago, and I used every single free moment to read it. I think it is one of the most useful books I have ever read.

I used to have many tests written around the anemic domain model, which helped a lot with protection against regression, but their refactoring was taking a good 60% of programming time – all due to test fixing. These tests were very, very, very brittle. And very expensive in the long run.

Reading this book has been a sort of epiphany: now I have a logical foundation that explains me the reasons of what I personally experienced with my code refactoring.

– Andrea Zanetti, Operations Director, Cimolai

quote

This is great book on Unit Testing. I finally understood what a “Unit” is and more, how it is seen by the London and Chicago schools. It contains valuable advice on what makes a good unit test and how unit tests enable sustainable growth of a project. This is a must read for any developer.

I liked it so much, that I started a book club with my colleagues where we go over the book in detail.

– Dragos Rogojan

quote

Absolutely practical and useful book. The author can convey his ideas in a consistent and pragmatic way, with all the necessary underlying theory and without architecture astronaut’s solutions.

The examples in the book are really perfect. The test application’s idea is dead simple, so everybody can understand the domain, read the code without C# knowledge. But with the help of slight modifications, the author illustrates the main ideas of the different chapters. So I’m especially grateful to the author for being able to write such a book without unnecessary complexity.

– Vladimir Kuptsov, Lead Software Engineer, Reddit

quote

This is a book that every developer and software architect should read. You’ll probably find yourself reading it again and again and getting more out of it each time. It will feed into your professional practice and make you a better developer. Writing better unit tests forces you to become a better software architect. This book is an indispensable resource.

– Greg Wright, Technical Architect, Kainos Software Ltd.

quote

This book covers about any question you could have about unit tests, from what to test about database calls to whether or not you test what you log.

In my mind this is a great design book under the guise of a unit testing book. Don’t get me wrong. The author goes to great lengths on unit testing, why you should do it, and how to identify and write good tests. But the real heart of this book is on how to structure your code to unit test effectively. There’s a lot of value in that that a lot of resources don’t explore.

– Jeremy Lange

quote

Now, that’s what I call modern approach to unit testing. Precise, easy to understand, and engaging explanations of concepts essential to create robust software. You feel your brain growing as you progress through chapters and you will never look at unit testing the same way.

A true software craftsman cannot ignore the techniques in this book.

– Sumant Tambe, Sr. Software Engineer, Linkedin

quote

A book on Unit Testing that will stand the test of time! This book is sure to be classic, a must-read for anyone willing to create value and increase return on investment in Unit Testing.

– Srihari Sridharan, Principal Member of Technical Staff, athenahealth

quote

This book will not only help you write better tests but more importantly will help you write code that is more easily testable. I wish I had this book twenty years ago when I was starting my careen in software development.

– Conor Redmond, Project Manager, Incomm Product Control

quote

This book should be read by all developers. It provides the type of content that you have to read between the lines of many other books and puts into words things that are often intuited. This book will give you a new perspective on unit testing; you will become much better at judging the quality of a test and subsequently improving your tests and your software.

– T.J. van Deurzen

quote

I discovered the unit testing concept early on in my career and have used it as much as I can. I never felt like I knew it well enough. I have researched the subject, tried to practice as much as I could. But it never felt like I was doing it properly. Reading this book have made me think I might know why that has occurred. Partly, I think it is due to not appreciating how much the overall design of your code impacts the unit tests you write.

The other reason is not having a way to recognize problems. So much of what software developers do is to recognize patterns and communicate them effectively. I admire how effortless the author makes this seem. Sharing a common understanding of the issues/problems with our unit testing practices is the first and probably most important step in improving and growing as developers. With all this now in my hands, I feel like I can start on a path to better unit testing practices and providing more value to my clients.

– Matthew Edgar, https://twitter.com/edgamat

quote

Get a 40% discount