http://www.perlmonks.org?node_id=158583


in reply to The Joy of Test

Further, once I find I need to rework the inner magic of my code, I am confident that I can make nice, sweeping changes and still run my tests and know instantly what went wrong. As this is a research project for my work, I've repeatedly been forced to rework things to try new ideas.

Pure bliss :) Tests. Don't leave home without 'em.

You summed up perfectly the reason we need tests! Code changes, bugs are fixed/introduced. Bugs are bad, so we need to know when they spring to life. Tests are a simple way to quickly & easily verify your code works as expected. As we all know, lazyiness & hubris are the virtues esposed by perl programmers. You put in a little time up front to save a lot of time & headache further down the line. I hate repetition, and anything to reduce it is good in my book. Without tests, there is always a chance that you've missed something. I was sucked in by the excellent article on perl.com which should be required reading for newbie testers.

IMHO, there is not a good excuse to NOT write tests. It could probably be argued that not writing them is a bit negligent on the programmer's part (not to start a flame war...). And with the wonderful modules that the ingenius Michael Schwern has given us, tests are so simple. Witness Test::Simple, Test::More, Test::Harness, and most recently Test::Inline (Write tests inline in POD!). Is there really a good reason to not write tests? I definitely realize that some things are hard to test (like web app controllers - I'd love to hear how you test those), but I do think everything deserves at least a simple test or two. Even if it's just use_ok('My::Module::Name');