Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Testing in real life

by sundialsvc4 (Abbot)
on Dec 27, 2011 at 21:53 UTC ( [id://945247]=note: print w/replies, xml ) Need Help??


in reply to Testing in real life

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://945247]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2025-04-17 21:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.