in reply to Testing parameters and return values
The best way to do this is with a test suite. Testing your returns and input at run-time will cause performance degradation, and make it harder to modify the code by locking you down to how the code is written, versus what the code is supposed to do.
Test::More is a pretty standard module for writing your tests with, and once you have started down that path Devel::Cover will be invaluable to find code paths you haven't tested yet.
But what about scripts? If you refactor your scripts to be thin wrapppers around a module that you call, you can test the module and be confident the API's in your code that your script uses all work correctly and as you expect them to.
Another large benefit to testing is it makes refactoring much easier, as you can rip out and rework large sections of code without worrying about if what the code is supposed to do is broken.
Test driven development is a good subject to be familiar with, check it out. You might like it.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Testing parameters and return values
by tirwhan (Abbot) on Nov 04, 2005 at 21:33 UTC |