MAN page from RedHat Other perl-5.004-0.1.i386.rpm
Test::Harness
Section: Perl Programmers Reference Guide (3)
Updated: perl 5.004, patch 04
Index NAME
Test::Harness - run perl standard test scripts with statistics
SYNOPSIS
use Test::Harness;
runtests(@tests);
DESCRIPTION
Perl test scripts print to standard output
"ok N" for each singletest, where
N is an increasing sequence of integers. The first lineoutput by a standard test script is
"1..M" with
M being thenumber of tests that should be run within the testscript.
Test::Harness::runtests(@tests) runs all the testscriptsnamed as arguments and checks standard output for the expected
"ok N" strings.
After all tests have been performed, runtests() prints someperformance statistics that are computed by the Benchmark module.
The test script output
Any output from the testscript to standard error is ignored andbypassed, thus will be seen by the user. Lines written to standardoutput containing /^(not\s+)?ok\b/ are interpreted as feedback forruntests(). All other lines are discarded.
It is tolerated if the test numbers after ok are omitted. In thiscase Test::Harness maintains temporarily its own counter until thescript supplies test numbers again. So the following test script
print <<END; 1..6 not ok ok not ok ok ok END
will generate
FAILED tests 1, 3, 6 Failed 3/6 tests, 50.00% okay
The global variable
$Test::Harness::verbose is exportable and can beused to let
runtests() display the standard output of the scriptwithout altering the behavior otherwise.
The global variable $Test::Harness::switches is exportable and can beused to set perl command line options used for running the testscript(s). The default value is -w.
EXPORT
&runtests is exported by Test::Harness per default.
DIAGNOSTICS
- All tests successful.\nFiles=%d, Tests=%d, %s
- If all tests are successful some statistics about the performance areprinted.
- FAILED tests %s\n\tFailed %d/%d tests, %.2f%% okay.
- For any single script that has failing subtests statistics like theabove are printed.
- Test returned status %d (wstat %d)
- Scripts that return a non-zero exit status, both $? >> 8 and $? areprinted in a message similar to the above.
- Failed 1 test, %.2f%% okay. %s
- Failed %d/%d tests, %.2f%% okay. %s
- If not all tests were successful, the script dies with one of theabove messages.
SEE ALSO
See the
Benchmark manpage for the underlying timing routines.
AUTHORS
Either Tim Bunce or Andreas Koenig, we don't know. What we know forsure is, that it was inspired by Larry Wall's TEST script that camewith perl distributions for ages. Numerous anonymous contributorsexist. Current maintainer is Andreas Koenig.
BUGS
Test::Harness uses $^X to determine the perl binary to run the testswith. Test scripts running via the shebang (
#!) line may not beportable because $^X is not consistent for shebang scripts acrossplatforms. This is no problem when Test::Harness is run with anabsolute path to the perl binary or when $^X can be found in the path.
Index
- NAME
- SYNOPSIS
- DESCRIPTION
- EXPORT
- DIAGNOSTICS
- SEE ALSO
- AUTHORS
- BUGS
This document was created byman2html,using the manual pages.