prove - Run tests through a TAP harness.
2. USAGE ▲
prove [options] [files or directories]
3. OPTIONS ▲
-v, --verbose Print all test lines. -l, --lib Add \*(Aqlib\*(Aq to the path for your tests (-Ilib). -b, --blib Add \*(Aqblib/lib\*(Aq and \*(Aqblib/arch\*(Aq to the path for your tests -s, --shuffle Run the tests in random order. -c, --color Colored test output (default). --nocolor Do not color test output. --count Show the X/Y test count when not verbose (default) --nocount Disable the X/Y test count. -D --dry Dry run. Show test that would have run. --ext Set the extension for tests (default \*(Aq.t\*(Aq) -f, --failures Show failed tests. -o, --comments Show comments. --fork Fork to run harness in multiple processes. --ignore-exit Ignore exit status from test scripts. -m, --merge Merge test scripts\*(Aq 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. --timer Print elapsed time after each test. --normalize Normalize TAP output in verbose output -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 --norc Don\*(Aqt process default .proverc
Options that take arguments:
-I Library paths to include. -P Load plugin (searches App::Prove::Plugin::*.) -M Load a module. -e, --exec Interpreter to run the tests (\*(Aq\*(Aq 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 in an archive file. -j, --jobs N Run N test jobs in parallel (try 9.) --state=opts Control prove\*(Aqs persistent state. --rc=rcfile Process options from rcfile
4. NOTES ▲
4.1. .proverc ▲
If ~/.proverc or ./.proverc exist they will be read and any options they contain processed before the command line options. Options in .proverc are specified in the same way as command line options:
# .proverc --state=hot,fast,save -j9 --fork
Additional option files may be specified with the \f(CW\*(C`--rc\*(C'\fR option. Default option file processing is disabled by the \f(CW\*(C`--norc\*(C'\fR option.
Under Windows and VMS the option file is named _proverc rather than .proverc and is sought only in the current directory. .ie n .SS "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 \f(CW\*(C`README\*(C'\fR in the \f(CW\*(C`examples\*(C'\fR directory of this distribution.
4.2. Default Test Directory ▲
If no files or directories are supplied, \f(CW\*(C`prove\*(C'\fR looks for all files matching the pattern \f(CW\*(C`t/*.t\*(C'\fR.
4.3. Colored Test Output ▲
Colored test output is the default, but if output is not to a terminal, color is disabled. You can override this by adding the \f(CW\*(C`--color\*(C'\fR switch.
Color support requires Term::ANSIColor on Unix-like platforms and Win32::Console windows. If the necessary module is not installed colored output will not be available.
4.4. Exit Code ▲
If the tests fail \f(CW\*(C`prove\*(C'\fR will exit with non-zero status.
4.5. Arguments to Tests ▲
It is possible to supply arguments to tests. To do so separate them from prove's own arguments with the arisdottle, '::'. For example
prove -v t/mytest.t :: --url http://example.com
would run t/mytest.t with the options '--url http://example.com'. When running multiple tests they will each receive the same arguments. .ie n .SS """--exec""" 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 \f(CW\*(C`-e\*(C'\fR, or \f(CW\*(C`--exec\*(C'\fR switch:
prove --exec \*(Aq/usr/bin/ruby -w\*(Aq t/ prove --exec \*(Aq/usr/bin/perl -Tw -mstrict -Ilib\*(Aq t/ prove --exec \*(Aq/path/to/my/customer/exec\*(Aq
.ie n .SS """--merge""" If you need to make sure your diagnostics are displayed in the correct order relative to test results you can use the \f(CW\*(C`--merge\*(C'\fR 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. .ie n .SS """--state""" You can ask \f(CW\*(C`prove\*(C'\fR to remember the state of previous test runs and select and/or order the tests to be run based on that saved state.
The \f(CW\*(C`--state\*(C'\fR switch requires an argument which must be a comma separated list of one or more of the following options.
last 4 Run the same tests as the last time the state was saved. This makes it possible, for example, to recreate the ordering of a shuffled test. .Sp # Run all tests in random order $ prove -b --state=save --shuffle # Run them again in the same order $ prove -b --state=last
failed 4 Run only the tests that failed on the last run. .Sp # Run all tests $ prove -b --state=save # Run failures $ prove -b --state=failed
.Sp If you also specify the \f(CW\*(C`save\*(C'\fR option newly passing tests will be excluded from subsequent runs. .Sp # Repeat until no more failures $ prove -b --state=failed,save
passed 4 Run only the passed tests from last time. Useful to make sure that no new problems have been introduced.
all 4 Run all tests in normal order. Multple options may be specified, so to run all tests with the failures from last time first: .Sp $ prove -b --state=failed,all,save
hot 4 Run the tests that most recently failed first. The last failure time of each test is stored. The \f(CW\*(C`hot\*(C'\fR option causes tests to be run in most-recent- failure order. .Sp $ prove -b --state=hot,save
.Sp Tests that have never failed will not be selected. To run all tests with the most recently failed first use .Sp $ prove -b --state=hot,all,save
.Sp This combination of options may also be specified thus .Sp $ prove -b --state=adrian
todo 4 Run any tests with todos.
slow 4 Run the tests in slowest to fastest order. This is useful in conjunction with the \f(CW\*(C`-j\*(C'\fR parallel testing switch to ensure that your slowest tests start running first. .Sp $ prove -b --state=slow -j9
fast 4 Run test tests in fastest to slowest order.
new 4 Run the tests in newest to oldest order based on the modification times of the test scripts.
old 4 Run the tests in oldest to newest order.
fresh 4 Run those test scripts that have been modified since the last test run.
save 4 Save the state on exit. The state is stored in a file called .prove (_prove on Windows and VMS) in the current directory.
The \f(CW\*(C`--state\*(C'\fR switch may be used more than once.
$ prove -b --state=hot --state=all,save
.ie n .SS "@INC" prove introduces a separation between \*(L"options passed to the perl which runs prove\*(R" and \*(L"options passed to the perl which runs tests\*(R"; this distinction is by design. Thus the perl which is running a test starts with the default \f(\fR. Additional library directories can be added via the \f(CW\*(C`PERL5LIB\*(C'\fR environment variable, via -Ifoo in \f(CW\*(C`PERL5OPT\*(C'\fR or via the \f(CW\*(C`-Ilib\*(C'\fR option to prove.
4.6. Taint Mode ▲
Normally when a Perl program is run in taint mode the contents of the \f(CW\*(C`PERL5LIB\*(C'\fR environment variable do not appear in \f(\fR.
Because \f(CW\*(C`PERL5LIB\*(C'\fR is often used during testing to add build directories to \f(\fR prove (actually TAP::Parser::Source::Perl) passes the names of any directories found in \f(CW\*(C`PERL5LIB\*(C'\fR as -I switches. The net effect of this is that \f(CW\*(C`PERL5LIB\*(C'\fR is honoured even when prove is run in taint mode.
5. PLUGINS ▲
Plugins can be loaded using the \f(CW\*(C`-P\f(CIplugin\f(CW\*(C'\fR syntax, eg:
This will search for a module named \f(CW\*(C`App::Prove::Plugin::MyPlugin\*(C'\fR, or failing that, \f(CW\*(C`MyPlugin\*(C'\fR. If the plugin can't be found, \f(CW\*(C`prove\*(C'\fR will complain & exit.
You can pass arguments to your plugin by appending \f(CW\*(C`=arg1,arg2,etc\*(C'\fR to the plugin name:
Please check individual plugin documentation for more details.
5.1. Available Plugins ▲
For an up-to-date list of plugins available, please check CPAN:
5.2. Writing Plugins ▲
Please see \*(L"PLUGINS\*(R" in App::Prove.