Test Driven Development - Frequently Asked Questions II
Q: So is there a simple rule that captures the essence of TDD?
A: Funny you should ask. There is:
Before writing any production code you must have a failing test. Kent Beck (said something like that)
Q: So, these jsps – they don’t seem to have any tests.
A: Ah yes, but they contain no business or presentation logic. All that stuff is in model and helper classes, which are under test.
Q: Ok, so was there a failing test before you wrote those jsps?
A: Well, no…
Q: So…....
A: Ok, you got me. It bothers me, all right? It complicates the build, and I didn’t get round to it.
Q: Didn’t get round to it?
A: Ok, I’ll sort it out. Satisfied?
Q: Not exactly test-first is it?
A: I’m warning you: shut up now.
(Based on a real conversation that happened in my head.)

3 Comments:
If I may play devil's advocate (and thus commence an inappropriate overuse of religious metaphor...)
Once you've chosen to make use of a relatively detestable technology then I'm not sure it is necessarily sensible to undergo the self-flagellation of writing relatively low value and very high costs tests in order to achieve the pure and holy state of 100% coverage that makes my inner zealot happy.
If choosing to use something detestable was a reasonable decision or a necessary evil, I would tell this inner demon voice to pipe down. If it wasn't, then I'd grant it angel status, but perhaps consider whether it might be granting the revelation that its time to invest in improving testability: don't do the catechism, repair the church roof.
Detestable? That's a bit strong.... oh I see.
Right. Repair the church roof: err..., I'll get right on to that.
"I was minding my business
Lifting some lead off
The roof of the Holy Name church
It was worthwhile living a laughable life
To set my eyes on the blistering sight
Of a vicar in a tutu
He's not strange
He just wants to live his life this way "
I like your writing style Sir! Please keep at it.
Post a Comment
<< Home