Posted by: Stephen Oakman | October 19, 2009

It has to be the right ‘red’

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!

Advertisements

Responses

  1. 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


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: