First things first --> Test Driven(First) Development (TDD) is a *beaten to death* buzz phrase in the IT industry today. There are various proponents and opponents to this agile concept. Let me tell you that this book is neither a proponent nor an opponent to TDD, it just teaches you plain vanila unit-testing and how it will make you develop quality solutions.
Won't you agree if i say that we see or hear a few of the following during our typical work day.
1. JUnit, HttpUnit, DbUnit etc
2. Mock/Stub testing strategy
3. Repeatable tests, Continuous Integration
4. Innovative Testing frameworks like EasyMock, TestNG, Cactus etc
5. Designing and writing code for testability
Often, when we try to find out what exactly they are and how they are used in real projects, we are left with uninspiring documentation(if there is one) or we are left with a plethora of frameworks that do overlapping tasks. Without knowing *what, when and why's* of unit testing, we thrash it at the end of the day.
This book is an excellent resource in that it addresses the above questions and the questions that follow really well in a developer friendly manner.
1. Why to unit-test code? What advantages do you get by doing so? --> Quality, Confidence, Merciless Refactoring
2. What are the different types of tests that a software needs and how does unit testing fit into the overall picture? --> Unit, Integration, Functional and Acceptance tests
3. What is JUnit and how it fits into the unit-testing phase of our development process? --> Makes unit-testing a breeze
4. What tasks are not do-able with JUnit and how other frameworks and JUnit extensions address these issues? --> Cactus, EasyMock, HttpUnit, DbUnit etc
5. What are the different testing strategies that are available and when to use them? --> Stub, Mock, In-Container
6. What are the problems that you will encounter while unit testing and how to overcome them? --> Demotivation,
7. What are the different reasons that you will find to not do unit testing? Why and how to overcome them? --> Time Pressure, Not Applicable in my scenaro etc
8. How to test different types of artefacts? --> POJOs, Servlets, JSPs, Taglibs, Database Access, EJBs
9. How unit testing can be made fun? --> Profiling, metrics
10. All of these in a simple yet effective case study. --> Adminstration App.
There are a few *nice to have's* that this book missed:
1. Though it covers a lot of detail, i think the authors tried to cover too much ground in 350+ pages. Cactus was covered, but very superficially, particularly in the TestRunner area. I would expect greater detail in that area, because that is the most diffuclt part of cactus.
2. It would have been better if the authors concentrated more on *what to test* after the initial *how to test* chapters. I mean, since the authors are expert in this arena, it would have been better if they identified a few patterns on what gets commonly tested and put it forward to us. That would have been very useful.
Overall, this is a very well written book. The authors are not only technical experts, they are good writers as well. If you are even vaguely interested in trying out unit testing for your projects, you owe yourself to try this book and get enlightened.
Any program feature without an automated test simply doesn't exist. -- Kent Beck