Just another Perl shrine | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Great post, hippo! Like haukex, I've just got a couple of suggestions. I'll stay away from more advanced testing functionality as this is a "Basic" tutorial. Ensuring things die() when you expect them to, in combination of the like() and is() functions. If the call within the eval() succeeds, the 1 will be returned. If not, it dies, and the eval() returns undef:
Always use sane test messages, so that it's trivially easy to see the output and quickly identify in your test script where the test actually is. In the above, it specifies exactly what I'm testing (read()), it states that I'm specifically testing the addr param, and even signifies which iteration of the loop did/didn't break ($_). How to use skip. This is a basic piece of functionality that a blooming unit test writer needs to know. There are several ways and reasons to use this, but I'll stick to the most basic premises: Skip all tests in a file for any reason:
Skip all tests in a file based on external flag:
Skip all tests in a file if certain software isn't installed (stolen from a POD test):
Speaking of testing, yesterday I reached the 10,000 test mark on one of my larger, more elaborate projects :) Files=61, Tests=10032, 586 wallclock secs ( 8.68 usr 0.50 sys + 149.28 cusr 8.14 csys = 166.60 CPU)In reply to Re: RFC: Basic Testing Tutorial
by stevieb
|
|