JUnit Recipes
Practical Methods for Programmer Testing

J. B. Rainsberger with contributions by Scott Stirling

2004 | 752 pages
ISBN: 1932394230

$49.95 pBook + eBook (includes PDF, ePub, and Kindle)
$39.99 eBook only (includes PDF, ePub, and Kindle)
Browse all our mobile format eBooks.

RESOURCES

Look Inside Resources Downloads

DESCRIPTION

When testing becomes a developer's habit good things tend to happen--good productivity, good code, and good job satisfaction. If you want some of that, there's no better way to start your testing habit, nor to continue feeding it, than with JUnit Recipes. In this book you will find one hundred and thirty seven solutions to a range of problems, from simple to complex, selected for you by an experienced developer and master tester. Each recipe follows the same organization giving you the problem and its background before discussing your options in solving it.

JUnit - the unit testing framework for Java - is simple to use, but some code can be tricky to test. When you're facing such code you will be glad to have this book. It is a how-to reference full of practical advice on all issues of testing, from how to name your test case classes to how to test complicated J2EE applications. Its valuable advice includes side matters that can have a big payoff, like how to organize your test data or how to manage expensive test resources.

What's Inside

ABOUT THE AUTHORS

J. B. Rainsberger is a developer and consultant who has been a leader in the JUnit community since 2001. His popular online tutorial JUnit: A Starter Guide is read by thousands of new JUnit users each month. Joe lives in Toronto, Canada.

Scott Stirling is a Senior Software Engineer on the Platform and Tools team at Workscape, Inc. in Framingham, MA. He has been active in the JUnit community since 2000 and has contributed code to the Jakarta Ant <junit> task.

WHAT REVIEWERS ARE SAYING

"Readers will appreciate the structure of every recipe...and the professional approach to solving the mentioned problems. I also appreciated the recipes on test building (3.8, command line; 3.9, Ant; and 3.10, Eclipse); the use of environment variables; the remarks concerning IBM's Visual Age for Java, and the valuable information about Cactus; the extensible framework JUnitPP; the Javassist library; and loggers such as LogKit, Log4J, the Java 1.4 logging application programming interface (API), and the solution based on Log4Unit.

I highly recommend this book. I found that it not only contained valuable recipes, but also provided good references and Web links."
-- ACM's Computing Reviews

"There are many occasions when I'll reach for JUnit Recipes when explaining how to test complicated processes to my team members. ...it does an excellent job of explaining the use of JUnit in production projects. ...makes an excellent reference... The section on EJB testing is one topic that would be of interest to most developers. ...Also worthy of mention are the sections on XML and EJB testing. I believe these are two of the most difficult topics to explain, let alone test, yet the book covers them entirely....JUnit Recipes stands out from other JUnit books in that it is not written from a Test Driven Design (TDD) perspective....

I definitely recommend JUnit Recipes for any and all. Beginners and professional will appreciate it equally."
-- Javalobby.org

"I thought I would mention that after getting your JUnit Recipes book and using it for two months, I've made a decision today to replace one of the textbooks I use for the course on Software Testing and Maintenance I teach at SAIT with yours. The book has truly exceeded my expectations - lots of useful stuff. I also like your writing style. Thanks for the great job!"
-- Grigori Melnik, Lead Instructor, Southern Alberta Institute of Technology

"There are several ways to test software. Perhaps the easiest on the tester is to simply ship it and let the customers find the bugs. It has been argued that this is the standard practice in the case of certain operating systems, but of course that isn't true. JUnit -- the unit testing framework for Java -- is simple to use, but some code can be tricky to test. When you're facing this kind of challenge, this book is a good place to start looking for help. It has some one hundred and thirty-seven tested solutions to a wide range of testing problems. Along with these recipes, there is some valuable discussion on how testing saves time - just in case your boss needs convincing, there are some recipes for servlets, JSP's, EJBs, database code and much more. This is one of those books that you'll keep down off the book shelves on a corner of your desk so that you can reach it easily."
-- Books-On-Line

"Sometimes the tiniest things are the most useful. Nails, screws, paperclips and post-its are all small, simple objects that are used a thousand different ways. So it is with JUnit -- a small and really very simple testing tool that can find its way into every corner of your Java development.

Rainsberger's book is a compendium of those thousand ways that JUnit can be used (well, OK, more like 130 ways). Each recipe starts with a solid motivation and includes a worthwhile discussion afterwards. You quickly realize that the author is sharing hard-won experience with you on every page. There are sections on testing standalone code of every description, as well as detailed sections on testing servlets, EJBs, and other less tractable components.

I've been using JUnit for years, but I picked up quite a few useful tips from this enjoyable book. Highly recommended." --- 9 horseshoes
-- JavaRanch.com

"'Wow!' on two accounts: 1. I'm actually giving a 10 horseshoe rating to a book, and 2. 'JUnit Recipes' is a very thorough and comprehensive encyclopedia of excellent advice and examples on almost every coding situation I've ever wanted to test with JUnit.

J. B. Rainsberger has compiled a 700 page collection of scores of excellent recipes written in pattern-like fashion, clearly laying out testing problems in want of solutions and the practical recipes for solving the problems, including annotated code examples, step-by-step instructions, and plenty of quality explanations.

'JUnit Recipes' is destined to be a classic, and has earned a most prominent place on my bookshelf, as I'm certain I'll be referencing it frequently for new and better ideas on formulating JUnit tests.

What's that? You'd like to borrow my copy of 'JUnit Recipes?' No, get your own. I rated this book 10 out of 10 horseshoes, in case you hadn't noticed."
-- JavaRanch.com (second review)