Sunday, November 15, 2009

The Joy of a Small Failing Test

Up till now I could only come up with small tests that succeeded and large scale tests that failed.

What I needed was a small test that failed. I finally have one. And even better, it actually fails in the debugger :-)

It's not so easy to come up with a small failing test because to do that you have to narrow down which part of the code is failing. Which is half the challenge, the other half is to figure out why it's failing.

At least now I feel like I have the beast cornered and it's only a matter of time before I kill it.

The test is simple enough that I look at it and think "this can't fail". But it is failing, so obviously I'm missing something. I just hope it's not something too obvious in hindsight because then I'll feel really stupid when I find it.

1 comment:

Larry Reid said...

Don't we always feel stupid after we find the bug?

I help out once a month at Free Geek, fixing Ubuntu problems for people who earned their computers helping Free Geek recycle old electronics. I spent about 20 minutes trying to fix some guy's video problem with an on-line game, including some descents into video driver and X hell. Then I remembered that browsers have a "zoom" control. Once I set the zoom back to 100% he was good. Doh!