Books on Unit Testing and Test Driven Development
The best two books for getting started with TDD are Kent Beck's original "Test Driven Development: By Example" and David Astlers "Test-Driven Development: A Practical Guide".
To get the philosophy of TDD, Becks book is ideal. He runs through a simple "money" example based on some work that he did with Ward Cunningham and then goes on to show how he wrote the Unit Tests for JUnit (including showing how you really can solve bootstrap problems such as writing unit tests for a unit test framework!) which gives a much better sense of how he was thinking about the process.
David Astlers book provides another perspective and lots of specific examples of writing an application using TDD and is a great compliment to Becks book if you read it but still aren't quite sure where to go next.
Recently I've also heard good things about Lasse Koskela's Test Driven: TDD and Acceptance TDD for Java Developers, although I haven't read it yet (anyone had a look at this one?).
There are also chapters in books like Head First Software Development, Practices of an Agile Developer and Ship it! which are well worth reading. As with most things, reading a wide variety of source materials gives you a much richer feeling for a solution space, so I'd thoroughly recommend reading a few books to start to get comfortable with Unit Testing and TDD.
In terms of Unit Testing, I'm also just working my way through Pragmatic Unit Testing in Java with JUnit which provides lots of great additional information on naming and structuring tests, how to use mocks, and patterns and anti-patterns to consider. I'd definitely recommend it as a good practical "first book" for Unit Testing although I think that Becks book is still essential if you want to really get the feeling for what TDD (as opposed to just writing Unit Tests) is all about.
Any other recommendations for books on TDD or Unit Testing?





I know you weren't suggesting reading to the exclusion of acting, but I think the hardest step in all of this is to actually *do it*, because you'll never get over that initial fear of "I don't know how to do this, what if I fail" until you do.
I think after reading that book I came away with a new appreciation for how TDD drives your design, and I can see in my own coding how that is happening.
"My advice is to do it by the book, get good at the practices, then do as you will. Many people want to skip to step three. How do they know?"
That is true - you should learn from the book as well. Just don't stick to doing only reading - give it a whirl as you read, would be my advice (again, you is not referring specifically to "Peter Bell" here, it's just general)
http://www.amazon.com/Working-Effectively-Legacy-R...
I'm looking for a good third book that will provide some more advanced examples... I might give Astlers' book a try.
@Sammy: I agree with "just do it". The sooner you make the newbie mistakes the sooner you learn from them and stop being a newbie :)
http://dannorth.net/introducing-bdd
I also found the following IM to be really valuable:
http://www.pbell.com/index.cfm/2008/4/17/I-Just-Go...
Also, Dave Astels recently wrote something on BDD as he's now involved with the Ruby rspec implementation (can't immediately find the link).
If you're interested in testing, I'd thoroughly recommend checking out the ideas behind BDD as it's often described by experienced TDD'ers as "TDD done right (i.e. good TDD'ers already do things this way).