Classic unit testing mistake!

Got into the office this morning after a day out of the office and started hacking away at some code.  This particular bit of code was quite a way in.  Finished what I was doing... ran my tests and... excellent... all green  Run the entire suite for the project and nearly all of them went red.

Then I wondered, “did I do that, or where they all broken yesterday when I wasn't here?”

The moral of the story (and one that I'm reliably informed by my friend Tony I will continually relearn) is: run all the tests before you start hacking the code so you know if you broke them.

2 Comments

  • I agree Matthew. A "breakfast" unit test is a good practice. It ensures that everything is intact before we start tweaking and coding. A final unit test and a full project recompile is also advised at the end of the day Or maybe that's something automatically handled by the CVS.

  • ... I thought everyone was supposed to either comment out their tests, or make them pass before checking the code into source control...?

Comments have been disabled for this content.