by J. B. Rainsberger with contributions by Scott Stirling
My initial uses of JUnit are probably not unique. I found it a wonderful tool and a great way to replace the main methods I used to include in some (but not enough) of my Java classes. From the start, I could tell JUnit was powerful but I couldn’t clearly see easy ways to test everything I wanted to test. Over time, and through much trial and error, I learned how to test types of code that had troubled me at the start. If only I’d had JUnit Recipes I could have saved myself a tremendous amount of time and mistakes.
J. B. Rainsberger’s JUnit Recipes is a wonderful compendium of tips and tricks that can quickly take anyone from novice to expert at JUnit. The organization of the book should make it appealing to unit–testing programmers of all levels. Early chapters are highly introductory, covering the installation and first uses of JUnit. Later chapters cover testing of JDBC, Enterprise Java Beans, XML, and more.
JUnit Recipes includes the best discussions I’ve read on how to test database applications and on the complicated art of managing test data. This is probably not a book you will read every chapter of. In my programming, for example, I don’t use EJB so I only skimmed that chapter. But at over 700 pages is much more of an encyclopedia of wonderful testing techniques than a book that is meant to be read cover to cover. As its title implies, JUnit Recipes is a cookbook of ideas that will allow you to serve up better, and better–tested, applications.