This module is used by MakeMaker. If you're building a Perl extension
and if you have test scripts with filenames matching
extension's subdirectory, then you can run those tests by executing the
runs all test scripts named as arguments and
checks standard output for the expected "
" strings. (Standard Perl test scripts print
" for each single test, where
is an integer incremented by one each time around.)
After all tests have been performed,
performance statistics that are computed by the Benchmark module.
is exported by Test::Harness by default.
The first line output by a standard test script should be
being the number of tests that the test script
attempts to run. Any output from the test script to standard error is ignored
and bypassed, and thus will be seen by the user. Lines written to standard
output that look like Perl comments (starting with
are discarded. Lines containing
interpreted as feedback for
The global variable
is exportable and
can be used to let
display the standard output of
the script without altering the behavior otherwise.
It is tolerated if the script omits test numbers after
In this case Test::Harness maintains its own counter. So the following script
FAILED tests 1, 3, 6
Failed 3/6 tests, 50.00% okay
All tests successful.\nFiles=%d, Tests=%d, %s
If all tests are successful, some statistics about the performance are
FAILED tests %s\n\tFailed %d/%d tests, %.2f%% okay.
For any single script that has failing subtests, these statistics
Test returned status %d (wstat %d)
Scripts that return a non-zero exit status, both
are printed in a message similar to the above.
Failed 1 test, %.2f%% okay.
Failed %d/%d tests, %.2f%% okay.
If not all tests were successful, the script dies with one of the
to determine which Perl binary to run
with. Test scripts running via the shebang (
) line may not be
is not consistent for shebang scripts across
platforms. This is no problem when Test::Harness is run with an
absolute path to the Perl binary or when
can be found in the path.