|
JUnit in Action Vincent Massol with Ted Husted 2003 | 384 pages ISBN: 1930110995 |
|||
![]() |
$39.95 | Softbound print book | |
![]() |
$20.00 | ThoutReader + PDF ebook | |
Preface
To date tests are still the best solution mankind has found to deliver working software. This book is the sum of four years of research and practice in the testing field. The practice comes from my IT consulting background, first at Octo Technology and then at Pivolis; the research comes from my involvement with open source development at night and on weekends.
Since my early programming days in 1982, I’ve been interested in writing tools to help developers write better code and develop more quickly. This interest has led me into domains such as software mentoring and quality improvement. These days, I’m setting up continuous-build platforms and working on development best practices, both of which require strong suites of tests. The closer these tests are to the coding activity, the faster you get feedback on your code—hence my interest in unit testing, which is so close to coding that it’s now as much a part of development as the code that’s being written.
This background led to my involvement in open source projects related to software quality:
- Cactus for unit-testing J2EE components (http://jakarta.apache.org/cactus/)
- Mock objects for unit-testing any code (http://www.mockobjects.com/)
- Gump for continuous builds (http://jakarta.apache.org/gump/)
- Maven for builds and continuous builds (http://maven.apache.org/)
- The Pattern Testing proof of concept for using Aspect-Oriented Programming (AOP) to check architecture and design rules (http://patterntesting.sf.net/).1
JUnit in Action is the logical conclusion to this involvement.
Nobody wants to write sloppy code. We all want to write code that works—code that we can be proud of. But we’re often distracted from our good intentions. How often have you heard this: “We wanted to write tests, but we were under pressure and didn’t have enough time to do it”; or, “We started writing unit tests, but after two weeks our momentum dropped, and over time we stopped writing them.”
This book will give you the tools and techniques you need to happily write quality code. It demonstrates in a hands-on fashion how to use the tools in an effective way, avoiding common pitfalls. It will empower you to write code that works. It will help you introduce unit testing in your day-to-day development activity and develop a rhythm for writing robust code.
Most of all, this book will show you how to control the entropy of your software instead of being controlled by it. I’m reminded of some verses from the Latin writer Lucretius, who, in 94–55 BC wrote in his On the Nature of Things (I’ll spare you the original Latin text):
Lovely it is, when the winds are churning up the waves on the great sea, to gaze out from the land on the great efforts of someone else; not because it’s an enjoyable pleasure that somebody is in difficulties, but because it’s lovely to realize what troubles you are yourself spared.
This is exactly the feeling you’ll experience when you know you’re armed with a good suite of tests. You’ll see others struggling, and you’ll be thankful that you have tests to prevent anyone (including yourself) from wreaking havoc in your application.
Vincent Massol
Richeville (close to Paris), France
1 "As much as I wanted to, I haven’t included a chapter on unit-testing code using an AOP framework. The existing AOP frameworks are still young, and writing unit tests with them leads to verbose code. My prediction is that specialized AOP/unit-testing frameworks will appear in the very near future, and I’ll certainly cover them in a second edition. See the following entry in my blog about unit-testing an EJB with JUnit and AspectJ: http://blogs.codehaus.org/people/vmassol/archives/000138.html.
DESCRIPTION
Developers in the know are switching to a new testing strategy - unit testing - which interleaves coding and testing in an integrated way. This has proven to be a powerful combination that results in better designed software with fewer defects and faster delivery cycles.
JUnit in Action shows you how to benefit from this strategy using the popular open source testing framework, JUnit. It's a no fluff discussion of unit testing techniques and best practices. It gives examples of tough situations such as how to unit test EJBs, database applications, JSPs and Taglibs. It discusses unit testing of J2EE applications, and shows how to test in automated builds.
What's Inside
- Testing in isolation with mock objects
- In-container testing with Cactus
- Automated builds with Ant and Maven
- Unit testing from within Eclipse
- Test Driven Development principles
- Unit testing
- Java apps
- Servlets
- JSP
- Taglibs
- Filters
- EJB
- DB apps
More Information
If you have questions about JUnit in Action, please use the following mailing lists or forums:- For questions related purely to the book itself or for any other questions, please use the Manning Author Online Forum.
- For questions related to the book's source code, please use the SourceForge forum.
- For questions related to JUnit, please use the JUnit mailing list on YahooGroups.
- For questions related to Cactus, please use the Cactus mailing list.
- For questions related to Maven, please use the Maven mailing list.
WHAT THE READERS SAY ABOUT THIS BOOK...
"There are a lot of poorly written books out there. Some are just plain wrong and others just barely manage to solve the problem, but don't go much further than that. With a number of the Manning books I can see myself start to think differently about the problems and so I end up being a better developer. The JUnit in Action book was like that for me. At first it bothered me that I was changing my code in order to test it, but then I started seeing that the changes made the code better overall. Now my code is littered with factory methods and similar structures.
You guys are doing good stuff."
-- Joshua Smith, a reader
"The book is liberally sprinkled with JUnit best practices that every reader should take to heart. The examples are clear and real world. The author addresses the complex issues of unit testing EJBs, and web apps head on. He does not shy away from the real issues that come with testing these kinds of applications."
-- Wade Matveyenko, A Reader
ABOUT THE AUTHORS...
Vincent Massol is Chief Technology Officer of Pivolis which specializes in agile offshore software development.. Vince is an active member of the Maven, Gump and MockObjects development teams and the creator of the Jakarta Cactus testing framework. He lives in the City of Light, Paris, France.
Ted Husted is the lead author of Struts in Action.

