Home :: Books :: Computers & Internet  

Arts & Photography
Audio CDs
Audiocassettes
Biographies & Memoirs
Business & Investing
Children's Books
Christianity
Comics & Graphic Novels
Computers & Internet

Cooking, Food & Wine
Entertainment
Gay & Lesbian
Health, Mind & Body
History
Home & Garden
Horror
Literature & Fiction
Mystery & Thrillers
Nonfiction
Outdoors & Nature
Parenting & Families
Professional & Technical
Reference
Religion & Spirituality
Romance
Science
Science Fiction & Fantasy
Sports
Teens
Travel
Women's Fiction
Pragmatic Unit Testing in Java with JUnit

Pragmatic Unit Testing in Java with JUnit

List Price: $29.95
Your Price: $19.77
Product Info Reviews

<< 1 >>

Rating: 5 stars
Summary: an excellent introduction
Review: (The following is an excerpt of a review of "The Pragmatic Starter Kit" I posted at JavaRanch.)

"Pragmatic Unit Testing - In Java with JUnit" - the second volume in the three part "The Pragmatic Starter Kit" series" - from authors, Andrew Hunt and David Thomas, is an excellent introduction to the practice of unit testing - proving that a piece of code does what the developer intended it to do. If you're a new developer, hopefully you've asked yourself and others questions about how to establish that your code really works, how to feel confident that it keeps working after scores of changes have been made, what types of common problems and bugs should you be looking for, where are these problems likely to be, and what makes a good test. While answering those questions, this book also introduces the practice of testing with Mock Objects, how to organize the test code in a project, how to better design code for testability, and how to make use of JUnit for running all these tests. I'd recommend this book as a strong introduction to any developer new to or uncertain about the art of unit testing.


Rating: 3 stars
Summary: A good introduction but not Reference Shelf material
Review: Pragmatic Unit Testing is another outing for the "Pragmatic" brand. This time the authors apply their characteristic humour and collection of acronyms to unit testing, specifically as it applies to Java and using the JUnit software package.

The book gives a general introduction to the whys and wherefores of unit testing and then uses a good example to introduce JUnit as a mechanism for carrying out these tests. This is followed by various chapters that look into what you should test and when and where, etc. In this respect it covers much of the ground on unit testing and does it well but the truth is that there isn't all that much to cover; to the extent that the authors can even provide a one page at-a-glance summary of all their main points at the back of the book. This is fine and as an introductory text I would recommend the book.

On the other hand, there are a number of areas in unit testing that always present problems for developers. For instance:
How should private methods be tested? This is mentioned in passing but not really addressed.
Where should tests be stored? Some options are presented but their advantages and disadvantages barely mentioned.
How can systems such as databases or networks be simulated for test purposes? There is a short chapter on simple Mock Objects but after presenting a small example they conclude "and that's all there is to mock objects" and the rest of the chapter barely covers anything more.

In summary, the book is a good (if verbose) introduction for beginners but is of limited value for those who are already familiar with JUnit and are looking for a book that tackles the more difficult areas.

Rating: 5 stars
Summary: A cornucopia of wisdom
Review: Refusing to rest on their laurels from their 1999 success The Pragmatic Programmer, Andrew Hunt and David Thomas are back with a vengeance. They've taken a step back from their previous title to write The Pragmatic Starter Kit, billed as a prequel to The Pragmatic Programmer. The Pragmatic Starter Kit, meant to lay the foundation for a pragmatic programmer, consists of three titles: Pragmatic Version Control, Pragmatic Unit Testing, and Pragmatic Automation. Together, these titles show how to set up a sound development infrastructure, and educate as to fundamental practices, tools, and philosophies which may be used to enhance productivity within this infrastructure.

Pragmatic Unit Testing, the second volume of The Pragmatic Starter Kit, teaches the developer to code smartly by practicing a regime of disciplined unit testing. Hunt and Thomas begin by convincing the reader just why it is we must write unit tests, and then quickly debunk the most common excuses developers use for not testing. Now that we are suitably convinced, the authors go on to explain how to plan and write unit tests, how to work with the JUnit framework, and how to use mock objects.

Most books on this subject don't really go too far beyond how to write unit tests. Where this book stands head and shoulders above the rest though, is the great depth the book goes into showing us exactly what tests need to be written. Through a series of helpful mnemonics, the reader is taught exactly what to test, how to correctly test boundary conditions, and what the properties of good tests are. We are also given general testing principles to keep in mind, as well as questions to ask ourselves about our code while testing. The concepts given herein are invaluable, and if the book ended with just this, it would be well worth the money.

The book doesn't stop there however. The authors offer excellent advice for integrating unit testing within the scope of a project in a team environment, and we are given a look at how unit testing can influence design. Exercises are presented to help the reader practice key concepts throughout the book.

There are a couple of things that this book isn't. This book is not a treatise on how to unit test specific components in an application. As stated previously, this book is less about how to test specific components, and more about what tests should be written in the first place. This book also does not overtly espouse any particular process. Extreme programming and test-driven development are certainly mentioned, but they are not championed above other processes.

This book is concise, weighing in at around 159 pages. The book is a very quick and pleasant read. It is appropriate for the novice as well as the developer who's been around the block a couple of times. If you write unit tests, and particularly if you are new to the game, this book is a cornucopia of wisdom. Pragmatic Unit Testing is to the practice of unit testing, what Joshua Bloch's Effective Java is to the Java programming language. That's certainly high praise indeed.

Rating: 5 stars
Summary: Great Description of Unit Testing
Review: There has been a resurgent interest amongst developers in unit
testing, mostly spurred on by Extreme Programming, test-driven
development and the JUnit testing harness. But most of the discussion
has been on how tests can shape design, rather than on how tests can
<i>test.</i> This book does the best job of describing how JUnit-style unit
tests can actually be used for testing. The book is available in two
flavors: one in Java for JUnit and one in C# for NUnit.

Rating: 5 stars
Summary: bridging the gap
Review: Unit Testing is one of those widely accepted good practices that is not always well applied. This book helps to bridge the gap between what should be done and what is done.

While JUnit and Mock Objects are introduced in the text, the main focus is on developing insight into the philosophy of pragmatic unit testing. Most developers have a vague understanding of the why and how, but what do their results really mean? Are they sufficient to determine that the code is correct? How does the developer know?

With anecdotes and clear examples, the authors help to clear the fog. Just as important, they dispel many of the testing myths and explode the excuses that are offered for not unit testing. Resistance will frequently come developers, but also from management thinking that developing test code will add time to the project instead of saving it.

A side-effect of developing unit tests is that they add another layer of code that must be managed. Do you need tests for your test? Where does it end? Again the pragmatic programmers provide poignant pointers to managing the tests themselves.

One of the pragmatic programmer commandments must be "Be brief". In less than 160 pages, this slim volume covers a lot of ground. For a project technical lead, several copies for your team to read may be a solid investment. Be sure to make a poster-sized version of the "Pragmatic Unit Testing: Summary" page from the book for the wall behind your desk.


<< 1 >>

© 2004, ReviewFocus or its affiliates