March 2001
Intermediate to advanced
288 pages
4h 56m
English
Perl comes with code for testing perl itself, and you can use these same tools for your regression tests. They are deceptively simple. The Test::Harness module maintained by Andreas König exports a routine runtests that takes as arguments the names of programs to run. It looks for a header line of the form “1..max” and output lines that say either “ok n ” or “not ok n ”, where n is between 1 and max; all other output is ignored and discarded. When it's done with all the tests, it prints a summary containing either the magic word “successful” or the dreaded word “FAILED.”
But wait, there's more. The Test module[2] by Joshua Nathaniel Pritikin makes it easy for your programs to output the “ok/not ok” lines. It ...