Test Driven Development Applied

Lasse is writing a Manning book on practical TDD and acceptance testing for java developers.

I’m so excited I purchased the early access addition, signed up for the author forums, and started skimming the PDF of the first four chapters tonight. This is exactly the text my team and so many other java development teams have needed. Up until now I had a big todo on my Someday/Maybe list entitled:

  • Write a developer notebook style on unit testing java web apps (especially TDD with JSF)

Now I’ll actually see the concept in print.

Other Texts

As an early adopter it’s fairly easy to get caught up in TDD and forget how painful it can be to implement or understand for developers in the early majority. In the past I’ve looked at several texts to help transition my team:

Test Driven Development – Beck is great getting across the concept, but when you have to move past implementing a Money class and deal with things like Struts, JSF, or iBATIS and Hibernate the gulf can be hard to cross.

Pragmatic Unit Testing – A good overview text including the idea of fakes and mocking. Jumping to effectively testing a J2EE app is still a wide ravine.

JUnit in Action – Again another good introduction, but some of the solutions to deal with J2EE troubles is to utilize Cactus to do in-container testing. Your testing times really start stacking up.

JUnit Cookbook – A great sample of recipes that finally addresses some of the nastier cases like how you test JSP output. After looking all the ways to deal with testing JSPs I just felt dirty. And because it’s from 2004 it largely ignored the difficult to test world of JSF.

Agile Software Development, Principles, Patterns, and Practices – I love some of the TDD examples in here and the bowling game is a now a classic. Still the gap exists in how to apply this in J2EE land.

Acceptance Testing

Lasse is tackling unit testing the J2EE stack along with acceptance TDD. Introducing Fitnesse has been a big focus for the last year and we’re starting to really utilize it on projects. Still it suffers some in the documentation area and even the one book out focuses on FIT and ignores many of the gotchas that come up on Fitnesse.

While I think TDD has started to move closer to the mainstream, acceptance testing is still fairly leading edge from what I can see. I think quite a few java developers have heard of FIT or Fitnesse, but very few have even tried it out.

Conclusions

This just really bandages up a nasty pain I’ve had for too long around TDD, acceptance testing and J2EE. Two years ago I would have ordered twenty copies, put together some labs, and setup a reading group. It may have cut months of our adoption curb. Since we were more on the leading edge I got to figure out a lot of this as we went along from using the Shale mocking library to driving adoption by making setup easier with ObjectMother patterns.

Just skimming the first four chapters, knowing the quality of Lasse’s postings over the years, and realizing there is still much to learn I expect great things of this book. I’m sure I’ll be ordering a dozen copies come September.

Many thanks to Lasse for spending many future hours hammering out this tome.