Test::Harness - run perl standard test scripts with statistics


use Test::Harness;



Perl test scripts print to standard output ``ok N'' for each single test, where N is an increasing sequence of integers. The first line output by a standard test scxript is ``1..M'' with M being the number of tests that should be run within the test script. Test::Harness::runscripts(@tests) runs all the testscripts named as arguments and checks standard output for the expected ``ok N'' strings.

After all tests have been performed, runscripts() prints some performance statistics that are computed by the Benchmark module.


&runscripts is exported by Test::Harness per default.


All tests successful.\nFiles=%d, Tests=%d, %s
If all tests are successful some statistics about the performance are printed.

Failed 1 test, $pct% okay.

Failed %d/%d tests, %.2f%% okay.
If not all tests were successful, the script dies with one of the above messages.


See Benchmerk for the underlying timing routines.


Test::Harness uses $^X to determine the perl binary to run the tests with. Test scripts running via the shebang (#!) line may not be portable because $^X 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.