6.3. System or Regression Testing

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 ...

Get Perl Debugged now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.