When following the mantra of ‘Red, Green, Refactor’ the ‘Red’ step is often overlooked.
Even when getting to the ‘Red’ failing test step, it is important to check that it’s the right ‘red’. It’s far to easy to produce a failing test which fails for the wrong reasons. A quick check that it’s failing for the reasons you expect is worth it.
If you don’t check the failing test and skip straight to the implementation to make the test pass then you’ll keep getting a failing test. When this happens there’s a natural tendency for tunnel vision to creep in as you go deeper and deeper into finding out why it’s not working before an ‘ahha’ moment where you realise where the error is.
I speak from experience after being at that point far too many times. Not that I want to admit it as each time is a personal head slap moment as I realise how insanely foolish I’ve been.
So please, take the time to stop at red and check it’s the right shade of red before moving on to green. Forget the time it will save in the long run, and instead just be glad that you won’t feel the same shame and humiliation that I’ve felt in the past!
Follow the Red, it is your friend follow your friend go where it leads dont try and take a short cut through town, your requirements are a map follow the map.
Requirements Drive Tests , Tests Drive Code and around we go.
Follow the sirens song
By: Neil on November 15, 2009
at 2:07 pm