I am looking for a book or online resource that gives a good overview of the subject, and is also practical for implementing unit testing. The book should be useful for users of different programming languages.
views:
965answers:
12I read Kent Beck's Test Driven Development : By Example and I think it's fine. Also, Kent is one of the main advocates of unit testing.
Pragmatic Unit Testing With NUnit. Most of the information in the book is generic, and if you happen to be using NUnit, then so much the better. I believe there's a version of the book JUnit, as well.
It's not a "book", but I am blogging (hopefully clear enough for "newbies" but concise enough to make it useful) on my "TDD and Unit Testing" adventures on my blog.
It's still a read, and I only have my "Getting Started" article up at the moment, but I am getting great feedback and have lots more planned.
If you have a read, feedback is always welcome, I am really trying to improve my blog content and as with most things, comments from people such as yourself make the difference.
Still a read, and I often print out blog posts to read before bed :)
I second the Kent Beck book choice : "Test Driven Development by example". Easy to read, and providing a good sets of prtactices.
Test Driven Development: By Example
Having taught myself TDD through podcasts, blogs and so forth I bought this book. I really wish I'd bought this book before I started. It's perfect for someone new to the world of TDD, and gives you some great sound bytes for helping convince managers and so forth that it is a good idea.
I've read both the Kent Beck book and Pragmatic Unit Testing and recommend them both - depending on what you're looking for.
The Kent Beck book is about TDD - and is one of the best books on the subject. Pragmatic Unit Testing is about writing unit tests (not via TDD)
I'd recommend Kent Beck's book first. I also found Test Driven Development in Microsoft.NET to be pretty good if you are a Microsoft shop.
Kent Beck's Test Driven Development: By Example is short, readable and language agnostic (examples are given in one of Java, Python or Smalltalk). He explains the basic xUnit test framework pattern by building an xUnit implementation from scratch — using TDD every step of the way. Although it is really a book about TDD rather than just unit testing, it does a good job of demonstrating how to test your code unit by unit, without assuming any prior knowledge of automated testing.
Some other answers mention Gerard Meszaros' xUnit Test Patterns: Refactoring Test Code book (and website). It's a good book that covers a lot of concepts that Kent Beck's TDD book doesn't, and it starts with a nice walkthrough of refactoring some typical test code into beautiful unit tests. But it is large (nearly 900 pages, the majority devoted to being a reference for xUnit refactoring patterns), and most of it is quite dry, and frequently repetitious. That introductory walkthrough is very good, but the sheer bulk of the book is likely to scare off someone just looking to “get started”.
So I recommend Kent Beck's book for getting started with unit testing.
I liked the book "Unit Test Frameworks". It gives an overview of the various frameworks and insight into their internal workings. Along the way there a good tips on good test driven development practices.
As a beginner in unit testing, I really really liked Art Of Unit Testing
I did some researches on books available and this one seemed better than the others to explain what is a good unit test, what should be tested, how to tests existing code, etc.
After looking at the first chapter free online we buyed the early access edition PDF and it was worth every penny.
For starters, if you have a legacy product, none is better than Working Effectively with Legacy Code by Michael Feathers.