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

This is an excellent book. I have some friends and we are using it for a book club right now. I’ve been doing software for 20+ years and this is one of the best books on the topic I’ve read, and I’ve read a lot. Ranks up there alongside Refactoring, Clean Code, and XUnit Patterns in my opinion.

– David Moore

quote

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

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

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. 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

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

Get a 40% discount