Advanced Search
Start Your Free Trial

Overview

Other Readers Also Read...
Refactoring: Improving the Design of Existing Code

Refactoring: Improving the Design of Existing Code
by Martin Fowler; Kent Beck; John Brant; William Opdyke; Don Roberts

Test-Driven Development: A Practical Guide

David R. Astels

Foreword by Ron Jeffries

  • The relentlessly practical TDD guide: real problems, real solutions, real code

  • Includes a start-to-finish project written in Java and using JUnit

  • Introduces TDD frameworks for C++, C#/.NET, Python, VB6, and more

  • For every developer and project manager interested test-driven development

Make Test-Driven Development work for you!

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.

  • o Relentlessly practical! Full of downloadable code examples, hands-on exercises, and a fully hyperlinked version of the "resources" appendix

  • o 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)

  • o Covers refactoring, "programming by intention," mock objects, and much more

  • o Discusses TDD frameworks for C++, C#/.NET, Python, VB6, Ruby, and Smalltalk

  • o Introduces previously unpublished test-first techniques for GUI software

  • o Contains appendices introducing eXtreme Programming and Agile Modeling

  • o For all programmers and project managers

Read this book if you're ready to write code that's clearer, more robust, and easier to extend & maintain--in short, if you're ready to write better code!

Amazon.com® Reader Reviews (Ranked by Helpfulness)

Average Amazon.com® Rating: 4.0 out of 5 rating Based on 15 Ratings

Falls short of its goal - 2004-04-17
Reviewer Rating: 1 star rating2 star rating3 star rating4 star rating5 star rating
This book is about Test-Driven Development (TDD). Its purpose is to help you write better code (by having more tests) and give you a head start with existing tools to achieve this.

The book falls short of these goals: The explanations about writing tests are short on advice and are sometimes misleading. The presentation of the tools is long, with little useful facts.

The book is organized into four parts: Background on TDD, refactoring and programming by intention; A look at JUnit and related tools used to write and run tests; A lengthy example of TDD; An overview of other tools in the xUnit family. The book is targeted at a Java audience but programmers using other languages should have little difficulties understanding the code.

I have a major problem with the background section. The author repeatedly claims that TDD provides exhaustive test coverage and ensures that you can refactor your code with confidence. Any error will be caught by the tests. This is foolish. First, tests rarely reach 100% code coverage. Even the sample that the author provides in the book ends up with less than 90% coverage. This leaves many gaps where tests will fail to detect errors. Even if tests cover 100% branches in the code tests are not exhaustive. Depending on the data used, the same branch may exhibit different behavior. (Not to speak about race conditions and other sources of hard to find bugs.) I fully agree with the author that writing unit tests will improve the quality of the code and help find bugs. But claiming that this is a silver bullet is not wise. I would recommend reading books about tests (e.g., Myers' The Art of Software Testing and McConnell's Code Complete chapter on unit testing) in addition to this book. The section on refactoring is a summary of Martin Fowler's Refactoring book which I recommend.

The second part presents JUnit. JUnit is a framework used to write and run tests. It is a good presentation. However I would have liked to get pieces of advices on what tests to write in addition to how to write them. The author briefly mentions boundary testing but does not have much to say about the tests themselves. Again a test book is invaluable for this. The author recommends using a test coverage tool as well as Jester to measure the tests coverage. This is a great idea.

The third section is an (overly) extended example: the author walks us through writing TDD code. This could have been a great part, giving meaning to the `practical' adjective in the book title. Unfortunately it is a long rambling, showing lots of code but short on insights. The actual `meat' of this part could be summarized in less than five pages.

The last section presents variations on the JUnit tool. Many languages (C++, C#, VB, Python, etc) are discussed. This part would have been better put on a website rather than printed in the book. Given the changes in some of these frameworks the information is obsolete.

The books ends with several appendices dealing with extreme programming and agile modeling.

Unit tests are a great tool to improve code quality. Whether or not you actively practice TDD, a good book on it can provide insights into improving your code. This book contains some interesting bits of wisdom. However much of it is buried by the rest of the material.

Great work covering TDD from the ground up to adv. topics - 2004-05-12
Reviewer Rating: 1 star rating2 star rating3 star rating4 star rating5 star rating
(Disclaimer: I worked with the author on one large project).
Dave Astels' book is a comprehensive work covering TDD from the ground up to advanced topics. While most of the book examples use Java and JUnit, it does cover unit testing frameworks in several other languages as well. I've read two books on the topic (the other one is Kent Beck's "TDD By Example") and I liked Dave's book better. The basics of TDD can be explained in 10 minutes however when it is applied on practice it gets complicated in at least 3 areas: 1) testing UI 2) testing with database - data setup, isolation, etc. and 3) mocks. Kent's book is more about a philosophy of TDD but it only goes through a very simple "toy" example. Dave's book really helped me to understand mocks and it does cover UI testing in great length. Mocks are an advanced topic, so it does require a good knowledge of Java and OOP. The rest of the book seems to be on intermediate technical level.

The only thing this book is missing, I think, is a discussion about data setup and database-related testing, dbUnit, etc., other than an advice to avoid it altogether (p. 83). While you can indeed use mocks to avoid it, on the large real projects some kind of integration testing (including testing with the database) will be necessary. I hope the second edition will come out at some point!

Overall, it's a great book for both newcomers and developers with unit testing experience. BTW, it won SD West 2004 Jolt Award.

Very helpful but not perfect - 2006-11-06
Reviewer Rating: 1 star rating2 star rating3 star rating4 star rating5 star rating
Context: I've read a fair amount about TDD (including being a technical reviewer for Kent Beck's "By Example" book), but went a long time without getting a chance to use TDD. David Astels' book gave me a chance to get a little down and dirty with the technique and some of its associated frameworks.

Maybe too dirty? As others have said, the source code in Part III of the book doesn't do what the book describes; you need to go to Mr. Astels' web site and get updated source code.

I found the coverage of Java frameworks (in part II) to be very helpful; it expanded my understanding of what TDD techniques can be used.

Great Book on Test Driven Development - 2009-08-14
Reviewer Rating: 1 star rating2 star rating3 star rating4 star rating5 star rating
Out of the 3 books I have read about test driven development (TDD), this is by far the best. In fact, the other two were terrible.

What's great about this book? It is easy to understand, even for someone who has never learned TDD before (like me). Also, it is extremely thorough. The book goes through the entire process of developing a complete (although simple) application. I think many authors would have just shown how TDD works with a variety of examples, but this book goes through the creation of the entire application, step by step. It's actually a very long book, 562 pages, with fairly small type. The desire to write the whole application when a set of examples would have been quicker and easier shows us that the author is really committed to being thorough. I guess that's what TDD is all about.

Another great thing about the book is that although the lengthy application is written in Java, the book works for any object oriented language. I develop in C# and C++, and it is immediately obvious how to translate the Java to C# or C++. So the book really works for any object oriented language, as long as you have an intermediate level of ability so you can understand what he is doing.

Besides that, there is a chapter on how to do TDD in a variety of languages: C#, C++, Smalltalk, Ruby, Python, and Visual Basic.

Although I am a beginner at TDD, I would agree that the tests that the author describes may not test 100% of the code. However, I think his approach is probably more thorough and better than the vast majority of programmers'. Besides, I'm sure the tests can be expanded to provide better code coverage.

Great book! - 2004-06-27
Reviewer Rating: 1 star rating2 star rating3 star rating4 star rating5 star rating
Whether you are a novoice or have been practicing TDD, this book is worth reading. It is really well organized, has great examples and explains how to use available TDD tools.
Great job, David!

Browse Similar Topics

Top Level Categories:
Software Engineering

Sub-Categories:
Software Engineering > Testing and Debugging

Some information on this page was provided using data from Amazon.com®. View at Amazon >


About Safari Books Online • Terms of Service • Privacy Policy • Contact Us • Corporate Licenses • Help • Accessibility | See us on FacebookSee us on Linked InSee us on TwitterRSS

Copyright 2009 Safari Books Online. All rights reserved.