Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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
share

locked by World Engineer Jul 21 '13 at 11:16

This question exists because it has historical significance, but it is not considered a good, on-topic question for this site, so please do not use it as evidence that you can ask similar questions here. This question and its answers are frozen and cannot be changed. More info: help center.

closed as not constructive by Mark Trapp Dec 8 '11 at 17:34

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

    
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

7 Answers 7

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

share

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

share

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.

share

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.

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

share

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

share

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.

share

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