Test-Driven Development: A Practical Guide enables developers to write software that's simpler, leaner, more reliable...just plain better. Now, there's a TDD guide focused on real projects, real developers, real implementation challenges, and real code.
Renowned agile development expert Dave Astels shows TDD at work in a start-to-finish project written in Java and using the JUnit testing framework. You'll learn how "test first" works, why it works, what obstacles you'll encounter, and how to transform TDD's promise into reality.
Relentlessly practical! Full of downloadable code examples, hands-on exercises, and a fully hyperlinked version of the "resources" appendix
Introduces powerful TDD tools and techniques--including key JUnit extensions, presented by their creators (Scott Ambler, Tim Bacon, Mike Bowler, Mike Clark, Bryan Dollery, James Newkirk, Bob Payne, Kay Pentacost, and Jens Uwe Pipka
Covers refactoring, "programming by intention," mock objects, and much more
Discusses TDD frameworks for C++, C#/.NET, Python, VB6, Ruby, and Smalltalk
Introduces previously unpublished test-first techniques for GUI software
Contains appendices introducing eXtreme Programming and Agile Modeling
For all programmers and project managers
Review By: Stephen Long 07/08/2010Astels' "Test-Driven Development: A Practical Guide" lives up to its promise of demonstrating the advantages of writing tests first and then writing the necessary code to make the tests pass. The development journey should be a series of many small steps with frequent checkpoints that provide feedback on the progress.
The bulk of the book addresses the "practical" part of the title, which was refreshing. I struggled with some of the code because I was not familiar with many of the Java classes, but I found executing the example code to be rewarding and educational. Astels highly recommends the Eclipse IDE but it has a steep learning curve; I never became comfortable with the debugger and there probably was too much functionality in the IDE for this project.
The book is not directly relevant to a QA/Test team because it focuses on unit testing and changing the way a programmer thinks about development. But I think serious testers would gain much from reading this book because it should enable them to communicate better with developers. Some of the techniques described in this book would also be great hooks for later function and integration tests. In addition, Asters provides good insights into the task of writing tests.
Although written for developers, testers will find this book rewarding. I highly recommend it as a core part of the serious tester's library. It is well worth the cost. Part I discusses test-driven development (TDD) theory, refactoring, and programming by intention, which are all central to the Agile programming mindset. Part II details various tools used in TDD, especially JUnit and JUnit extensions. Part III is a Java project that walks through the development of an application that keeps track of movies. Part IV discusses other members of the xUnit family, including RubyUnit, Sunit (Smalltalk), CppUnit, Nunit (.NET), PyUnit (Python), and VBUnit. Part V (Appendices) gives an introduction to Extreme Programming and Agile Modeling, provides a comprehensive list of resources, and gives detailed answers to the programming exercises.
Astels' website http://www.adaptionsoft.com/tddapg.html provides source code for the movie list project in Chapter 10. Note: Chapter 10's source code on the webpage does not include the refactoring that is at the very end of the chapter. Although there is a logical progression through the project, the placement of some of the methods in the classes was not always obvious, but the full source code was very helpful as I worked my way through the project.
Some minor typos in the book and an unstated change in a class made compiling occasionally frustrating, but, in all, the project fully supports Astels' thesis. Astels presents DatabaseChecker in his tools chapter but then uses a flat file to persist the project's data. Using this test utility would have strengthened the project.