March 23, 2004
Fix a Bug, Write a Test
A good piece by Steven Feuerstein on Cleaning Up PL/SQL Practices in OTN.
What struck me was a point he made about test driven development. In essence, he says that when you find and fix a bug write a unit test to ensure that your fix works. It's not a point I had come across before, but it's so blindingly obvious that I'm surprised I haven't figured it out. Well, alright, read it elsewhere.
It works on a number of fronts - if there was an existing test then this bug wouldn't have been raised, adding a new test to make sure your software does what it's supposed to do is always a good thing, and you are protecting your functionality against accidental breaks in the future.
Posted by Andy Todd at March 23, 2004 08:17 PM
I've been trying to follow this practice since reading Refactoring and it's great advice. Even better: *before* fixing the bug, write the test and make sure it reproduces the bug. Then fix the code and confirm that your test actually tested what you thought it would.
Posted by: Lisa Dusseault on March 27, 2004 06:00 PMAbsolutly: write the test first, *then* fix the bug.
Posted by: Simon Brunning on April 14, 2004 11:37 AM