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'

--merge

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.

--state

You can ask prove
to remember the state of previous test runs and
select and/or order the tests to be run based on that saved state.

The --state
switch requires an argument which must be a comma
separated list of one or more of the following options.

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.

# Run all tests in random order

$ prove -b --state=save --shuffle

# Run them again in the same order

$ prove -b --state=last

failed

Run only the tests that failed on the last run.

# Run all tests

$ prove -b --state=save

# Run failures

$ prove -b --state=failed

If you also specify the save
option newly passing tests will be
excluded from subsequent runs.

# Repeat until no more failures

$ prove -b --state=failed,save

passed

Run only the passed tests from last time. Useful to make sure that no
new problems have been introduced.

all

Run all tests in normal order. Multple options may be specified, so to
run all tests with the failures from last time first:

$ prove -b --state=failed,all,save

hot

Run the tests that most recently failed first. The last failure time of
each test is stored. The hot
option causes tests to be run in most-recent-
failure order.

$ prove -b --state=hot,save

Tests that have never failed will not be selected. To run all tests with
the most recently failed first use

$ prove -b --state=hot,all,save

This combination of options may also be specified thus

$ prove -b --state=adrian

todo

Run any tests with todos.

slow

Run the tests in slowest to fastest order. This is useful in conjunction
with the -j
parallel testing switch to ensure that your slowest tests
start running first.

$ prove -b --state=slow -j9

fast

Run test tests in fastest to slowest order.

new

Run the tests in newest to oldest order based on the modification times
of the test scripts.

old

Run the tests in oldest to newest order.

fresh

Run those test scripts that have been modified since the last test run.

save

Save the state on exit. The state is stored in a file called .prove
(_prove on Windows and VMS) in the current directory.

The --state
switch may be used more than once.

$ prove -b --state=hot --state=all,save

@INC

prove introduces a separation between "options passed to the perl which
runs prove" and "options passed to the perl which runs tests"; this
distinction is by design. Thus the perl which is running a test starts
with the default @INC
. Additional library directories can be added
via the PERL5LIB
environment variable, via -Ifoo in PERL5OPT
or
via the -Ilib
option to prove.

Taint Mode

Normally when a Perl program is run in taint mode the contents of the
PERL5LIB
environment variable do not appear in @INC
.

Because PERL5LIB
is often used during testing to add build directories
to @INC
prove (actually TAP::Parser::Source::Perl) passes the
names of any directories found in PERL5LIB
as -I switches. The net
effect of this is that PERL5LIB
is honoured even when prove is run in
taint mode.

PLUGINS

Plugins can be loaded using the -Pplugin syntax, eg:

prove -PMyPlugin

This will search for a module named App::Prove::Plugin::MyPlugin
, or failing
that, MyPlugin
. If the plugin can't be found, prove
will complain & exit.

You can pass arguments to your plugin by appending =arg1,arg2,etc
to the
plugin name: