Andy Armstrong > Test-Harness-2.99_01 > prove


Annotate this POD



New  29
Open  25
View/Report Bugs
Source   Latest Release: Test-Harness-3.37_01


prove - Run tests through a TAP harness.


 prove [options] [files or directories]


Boolean options

 -v,  --verbose     Print all test lines.
 -l,  --lib         Add 'lib' to the path for your tests (-Ilib).
 -b,  --blib        Add 'blib/lib' to the path for your tests (-Iblib/lib).
 -s,  --shuffle     Run the tests in random order.
 -c,  --color       Colored test output (default).  See TAP::Harness::Color.
      --nocolor     Do not color test output.
 -f,  --failures    Only show failed tests.
 -m,  --merge       Merge test scripts' STDERR with their STDOUT.
 -r,  --recurse     Recursively descend into directories.
      --reverse     Run the tests in reverse order.
 -q,  --quiet       Suppress some test output while running tests.
 -Q,  --QUIET       Only print summary results.
 -p,  --parse       Show full list of TAP parse errors, if any.
      --directives  Only show results with TODO or SKIP directives.
 -T                 Enable tainting checks.
 -t                 Enable tainting warnings.
 -W                 Enable fatal warnings.
 -w                 Enable warnings.
 -h,  --help        Display this help
 -?,                Display this help
 -H,  --man         Longer manpage for prove

Options which take arguments

 -I                 Library paths to include.
 -e,  --exec        Interpreter to run the tests ('' for compiled tests.)
      --harness     Define test harness to use.  See TAP::Harness.
      --formatter   Result formatter to use. See TAP::Harness.
 -a,  --archive     Store the resulting TAP into the specified archive file.

Reading from STDIN

If you have a list of tests (or URLs, or anything else you want to test) in a file, you can add them to your tests by using a '-':

 prove - < my_list_of_things_to_test.txt

See the README in the examples directory of this distribution.


Default Test Directory

If no files or directories are supplied, prove looks for all files matching the pattern t/*.t.

Colored Test Output

Specifying the --color or -c switch is the same as:

 prove --harness TAP::Harness::Color

Colored test output is the default, but if output is not to a terminal, color is disabled. You can override this by adding the --color switch.


Normally you can just pass a list of Perl tests and the harness will know how to execute them. However, if your tests are not written in Perl or if you want all tests invoked exactly the same way, use the -e, or --exec switch:

 prove --exec '/usr/bin/ruby -w' t/
 prove --exec '/usr/bin/perl -Tw -mstrict -Ilib' t/
 prove --exec '/path/to/my/customer/exec'


If you need to make sure your diagnostics are displayed in the correct order relative to test results you can use the --merge option to merge the test scripts' STDERR into their STDOUT.

This guarantees that STDOUT (where the test results appear) and STDOUT (where the diagnostics appear) will stay in sync. The harness will display any diagnostics your tests emit on STDERR.

Caveat: this is a bit of a kludge. In particular note that if anything that appears on STDERR looks like a test result the test harness will get confused. Use this option only if you understand the consequences and can live with the risk.


Because of its design, TAP::Parser collects more information than Test::Harness. However, the trade-off is sometimes slightly slower performance than when using the prove utility which is bundled with Test::Harness. For small tests suites, this is usually not a problem. However, enabling the --quiet or --QUIET options can sometimes speed up the test suite, sometimes running faster than prove.


prove, which comes with Test::Harness and whose code I've nicked in a few places (thanks Andy!).


This is alpha code. You've been warned.

syntax highlighting: