Wednesday, June 29, 2005

Wax On, Wax Off – Red Bar, Green Bar

TDD has become as automatic for me as breathing. It’s a beautiful thing when you get to start a new project from scratch and can write every line of code test-first. These days, however, I’m working on a legacy app with very little in the way of unit tests, and it feels as if I’m working at 5,000 meters above sea level and struggling for every breath of rarified atmosphere.

So I can only imagine how it seems to the rest of my team, for whom automated unit testing is a new concept. The level of drudgery involved in retrofitting a legacy app with a test harness rivals the chore of waxing Mr. Miyagi’s deck. All I can tell my teammates is that it’s good practice. Soon, writing unit tests becomes a habit, and then, eventually, it becomes pure instinct. Attack from the right? Wax On! Attack from the left? Wax Off! Add a new feature? HTTP-Unit! Change a business rule? JUnit! Keep it up, and that black belt will arrive in no time.

No comments: