![]() |
|
No such thing as a small change | |
PerlMonks |
Re: Testing in real lifeby sundialsvc4 (Abbot) |
on Dec 27, 2011 at 21:53 UTC ( [id://945247]=note: print w/replies, xml ) | Need Help?? |
The best that a test can ever do for you is to show you where a bug isn’t ... and this only if the test itself does not contain a bug. However, even though this may at first sound like a Faustian quest, it really isn’t, because another thing that a good test suite can tell you is: “it still passes.” So, after you have made a code-change and verified that it all compiles correctly, you add to the test suite (if necessary), and re-run the whole thing, and ... “good, it still passes.” When the tests suddenly begin to fail, they help you identify the bug while the bug is still “fresh.” Always bear in mind that the bug could be in the code, in the test suite, or both. (And, of course, that it is very hard to “bear in mind” that fact.) I like to write test suites before I write the actual code, because the test suite describes the code as I would like for it to be used and to behave. Sometimes I realize while writing the tests that my concept for the routine in question has a design-flaw in it. Very often while perfecting the module I discover that my implementation has a hole. But when everything actually works, I have pretty good reason for confidence that the code is fairly close now to being rock-solid and reliable.
In Section
Meditations
|
|