In my battle to introduce unit testing in my workgroup, I find a lot of people that have little to none knowledge of the concept. Can you suggest:

  • best articles or tutorials for quickly introducing people on the topic
  • best comprehensive book(s) for learning unit testing in depth
  • academic works and studies that prove the effectiveness of unit testing
  • No academic work proves that (unit) testing is effective per se. Academic work on testing aims at defining criteria more effective than others under certain conditions. – mouviciel Feb 2 '11 at 9:02
  • not quite the answer to your question, but can you or others on the team who are knowledgeable of unit tests do some pair programming with them to teach them. I learned like this from a colleague and it really helped me grok the agile philosophy more than reading about it did. – Alb Feb 3 '11 at 22:42
  • I would suggest going the other way around. Unit testing just for having to do it will not work well. I've found that Test Driven Design gives great result with less total work. – user1249 Feb 5 '11 at 9:35

I found Test Driven Development By Kent Beck to be a good introduction.


The Art of Unit Testing by Roy Osherove. Great practical examples on using unit and integration tests, employing mocking frameworks, etc.


Growing Object-Oriented Software, Guided by Tests was quite an eye-opener, the why, and the how all clearly laid-out on a book-long example.


G. Meszaros' xUnit Test Patterns: Refactoring Test Code is a kind of encyclopedia, the "Design Patterns" of unit-testing.

R. Osherove's The Art of Unit Testing: With Examples in .Net is a more practical guide to getting started with unit-testing and understanding the key concepts.

L. Koskela's Test Driven: TDD and Acceptance TDD for Java Developers appears to be the Art of Unit Testing for Java developers.

  • +1 for xUnit Test Patterns! – Tyler Holien Feb 5 '11 at 22:39

For actual unit testing, you can't go past Roy Osherove's The Art Of Unit Testing as ysolik mentioned. It goes through the actual technology used. Things like what is a mock, fake, stub, frameworks to use, test naming etc.

Other books such as Kent Becks Test Driven Development, which Matt suggested go through TDD, which is one way of doing unit testing, but it doesn't go into as much depth about unit testing as a technology. This book goes through an example application and goes through what would go through your head when writing tests first and the code afterwards.

A free article that is similar to Kent Becks book, in that it tells the story of developping an application, tests first is the XP Episode bowling example, by Robert Martin and Robert Koss.

I've read both books, starting with The Art of Unit Testing, and then moved onto Kent Becks to get a good idea of the process. I think that's a good way of learning it, if indeed you do want to learn Test Driven Development.


Only as an additional source for information about good testing is the Google Testing Blog!


I think that Unit Testing is now a term too vague.

The idea behind Unit Testing (from Wikipedia) "unit testing is a method by which individual units of source code are tested".

With time, the original idea is developing in something called Test Driven Development (the best book about this is Growing Object-Oriented Software, Guided by Tests) and something else called Behavior Driven Development (The Spec Book).

I suggest you to look at both and find the strategy more apt for your needs. You can also use both (as we do).

In any case, to take full advantage of testing you need to put it at the center of your design strategy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.