Pragmatic programmers use feedback to drive their development and personal processes. The most valuable feedback you can get while coding comes from unit testing.
Let your Java code tell you what’s working and what isn’t. You’ll learn how to test using JUnit, but more importantly, you’ll learn what to test.
For various technical reasons, the eBook version is a PDF: epub and mobi versions of this title will NOT be available.
You can also buy this title as part of the Pragmatic Starter Kit bundle.
About this Book
- 160 pages
- Release: P7.0 (2010-01-06)
- ISBN: 978-0-9745-1401-7
Without good tests in place, coding can become a frustrating game of “whack-a-mole.” That’s the carnival game where the player strikes at a mechanical mole; it retreats and another mole pops up on the opposite side of the field. The moles pop up and down so fast that you end up flailing your mallet helplessly as the moles continue to pop up where you least expect them.
You don’t test a bridge by driving a single car over it right down the middle lane on a clear, calm day. Yet many programmers approach testing that same way
- one pass right down the middle and they call it “tested.” Pragmatic programmers can do better than that!
Real unit testing will make your life easier. It will make your designs better and drastically reduce the amount of time you spend debugging.
With this book, you’ll:
- Write better code, faster
- Discover the best hiding places where bugs breed
- Learn how to think of all the things that could go wrong
- Test pieces of code without using the whole project
- Use JUnit to simplify your test code
- Test effectively with the whole team
Contents and Extracts
Comments and Reviews
—James J. O'Connor III Lead System Design Engineer
I am a firm believer in unit testing and I would want all team members I work with to be religiously practicing the techniques recommended in this book. I think there is a lot of good, practical information in this book that any professional software engineer should be incorporating into their daily work.
—Andrew Thompson Consultant Greenbrier & Russel
I’m not totally new to testing, but I’ve struggled with many aspects of it. I think this book does a good job of bringing those along who are completely new to unit testing, but still has enough advanced material to assist those of us who have dabbled in testing and floundered once we’ve hit obstacles.
—Bobby Woolf Consulting IT Specialist IBM
When I’m on a project that needs to be doing unit testing better (which is often the case), I’d like to have this book available as a simple reference to suggest to the team.
—Al Koscielny Software Developer
I wish I had a copy back when I started doing test-first development as part of Extreme Programming.
—Sharee L. Johnson Project Lead Applications Development
This book starts out with a nice introduction discussing what unit testing is as well as why we should do it. I like the anecdotes peppered throughout the book illustrating the point of why one should bother… I also really liked the analogies you use. It puts the code into a real-world context.
—Mike Clark Author, Consultant Clarkware.com
This is the most approachable and cogent JUnit book I’ve read… and I’ve read them all. If you’re new to unit testing with JUnit, this book will quickly get you started out on the right foot. Indeed, in the short amount of time it takes to read this excellent book you’ll learn more than I did in a year of fumbling around.
—Maik Schmidt Software Developer ATX Europe
It is the best introduction to unit testing that I’ve ever read! Excellent!