PROVE(1)
๐ PROVE(1) โ a total slay of a rewrite ๐
okay bestie, so this is prove from the Perl Programmers Reference Guide, and it's literally the main character of TAP harnesses. no cap, it runs your tests and tells you what's giving. let's get into it ๐
โจ NAME โจ
prove โ run tests through a TAP harness. that's it. that's the vibe. ๐ฆ
๐ธ USAGE ๐ธ
prove [options] [files or directories]
you hand it files or directories, it runs the tests. iconic. ๐
๐ OPTIONS ๐
๐ง Boolean options (the on/off girlies) โ they're just flags, no argument needed
-v,--verboseโ print, like, all the test lines. also setsTEST_VERBOSE. she's chatty ๐ฌ-l,--libโ add'lib'to the path for your tests, aka-Ilib. lowkey essential.-b,--blibโ addblib/libandblib/archto the path for your tests. both of them. periodt.-s,--shuffleโ run the tests in random order. chaos energy, but make it a feature ๐ฒ-c,--colorโ colored test output. this is the default, bestie โ color is already the moment ๐--nocolorโ do not color the test output. for when you want it plain, I guess ๐--countโ show the X/Y test count when not verbose. this is the default too, so you're already getting it.--nocountโ disable the X/Y test count. turn it off if you must ๐-D,--dryโ dry run. shows the tests that would have run. all the dress rehearsal, none of the actual running ๐ฌ-f,--failuresโ show the failed tests. the callout list, fr fr-o,--commentsโ show comments. give the people the commentary ๐ฃ๏ธ--ignore-exitโ ignore the exit status from test scripts. pretend you didn't see it ๐-m,--mergeโ merge test scripts'STDERRwith theirSTDOUT. two streams, one vibe ๐-r,--recurseโ recursively descend into directories. she goes deeper ๐--reverseโ run the tests in reverse order. backwards but make it fashion ๐ซ-q,--quietโ suppress some test output while running tests. shhh, she's focusing ๐คซ-Q,--QUIETโ only print summary results. the absolute bare minimum, and honestly? valid.-p,--parseโ show the full list of TAP parse errors, if there are any. receipts, gathered ๐งพ--directivesโ only show results that haveTODOorSKIPdirectives. filtered and fabulous โจ--timerโ print elapsed time after each test. clock it โฑ๏ธ--trapโ trap Ctrl+C and print a summary on interrupt. she catches you before you go ๐ซถ--normalizeโ normalize TAP output in verbose output. neat and tidy ๐-Tโ enable tainting checks. spicy ๐ถ๏ธ-tโ enable tainting warnings. spicy but warning flavor-Wโ enable fatal warnings. warnings that end you ๐ญ-wโ enable warnings. the regular ones, no fatality-h,--helpโ display this help. your girl, always ๐-?โ display this help. same energy, different key-V,--versionโ display the version. know your era ๐ท๏ธ-H,--manโ the longer manpage forprove. the director's cut ๐ฅ--norcโ don't process the default.proverc. skip the pregame ๐ซ
๐ Options that take arguments (these ones want a lil snack)
-Iโ library paths to include. give her the locations ๐-Pโ load a plugin. she searchesApp::Prove::Plugin::*. plug in, glow up ๐-Mโ load a module. just, like, bring a module along ๐-e,--execโ the interpreter to run the tests with.''(empty string) is for compiled tests, fyi ๐--extโ set the extension for tests. default is'.t'. tiny but mighty.--harnessโ define the test harness to use. see TAP::Harness. pick your fighter ๐ฅ--formatterโ the result formatter to use. see FORMATTERS. aesthetics matter ๐--sourceโ load and/or configure aSourceHandler. see SOURCE HANDLERS. sourcing the source, iykyk ๐ง-a,--archive_out.tgz_ โ store the resulting TAP in an archive file. save it for the group chat ๐ฆ-j,--jobs_N_ โ run N test jobs in parallel. the page literally suggests try 9. nine. go off ๐ฅ- **
--state=_opts_ โ controlprove's persistent state. she remembers things about you.๐ - **
--statefile=_file_ โ usefileinstead of.provefor state. rename your memory file, iconique - *
--rc=_rcfile_ โ process options from *rcfile. your own personal pregame file ๐ --rulesโ rules for parallel vs sequential processing. who runs together and who runs solo, the whole social dynamic ๐
that's part one, bestie โ the plot thickens in part two, so don't go anywhere ๐ซถโจ
๐ NOTES (the fine print, but make it cute)
๐๏ธ .proverc
So if ~/.proverc or ./.proverc exist, bestie, they get read and every option inside them gets processed before your command line options. And you write options in .proverc exactly the same way you'd write them on the command line:
# .proverc
--state=hot,fast,save
-j9
You can also point at extra option files with the --rc option. And if you want to shut off the default option-file processing entirely, that's --norc.
Heads up for the Windows and VMS girlies: the option file is named_provercinstead of.proverc, and it's only looked for in the current directory. ๐
๐ฅ Reading from STDIN
Got a whole list of tests (or URLs, or literally anything you want to test) sitting in a file? Just yeet a - in there and it'll add them to your tests:
prove - < my_list_of_things_to_test.txt
See the README in the examples directory of this distribution for more. ๐ซถ
๐ Default Test Directory
No files or directories supplied? No problem. prove goes looking for everything matching the pattern t/*.t. Iconic default behavior, honestly.
๐ Colored Test Output
Colored test output via TAP::Formatter::Color is the default, but if output isn't going to a terminal, color is disabled. Want to force it anyway? Add the --color switch, slay.
Color support requires Term::ANSIColor and โ on windows platforms โ also Win32::Console::ANSI. If the necessary module(s) aren't installed, colored output just won't be available. ๐ญ
๐ฆ Exit Code
If the tests fail, prove exits with non-zero status. Simple as that, no cap.
๐ฏ Arguments to Tests
Yes, you can absolutely pass arguments to your tests. Just separate them from prove's own arguments with the arisdottle, ::. Like:
prove -v t/mytest.t :: --url http://example.com
That would run t/mytest.t with the options --url http://example.com. And when you're running multiple tests, they each receive the same arguments. โจ
๐ --exec
Normally you just hand over a list of Perl tests and the harness knows how to execute them. But if your tests aren't written in Perl, or you want every test 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
Need to make sure your diagnostics show up in the correct order relative to test results? Use --merge to merge the test scripts' STDERR into their STDOUT.
This guarantees that STDOUT (where the test results appear) and STDERR (where the diagnostics appear) stay in sync. The harness will display any diagnostics your tests emit on STDERR. ๐ฆ
โ ๏ธ Caveat, and I mean it: 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. ๐
๐ชค --trap
The --trap option will attempt to trap SIGINT (Ctrl+C) during a test run and display the test summary even if the run is interrupted. So polite, honestly. ๐
๐พ --state
Okay this one's a whole vibe. You can ask prove to remember the state of previous test runs, and then select and/or order the tests to be run based on that saved state.
The --state switch requires an argument, and that argument must be a comma separated list of one or more of the following options:
"last"
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
And 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 no new problems have been introduced. ๐
"all"
Run all tests in normal order. You can specify multiple options, 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, and 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. (Yes, "test tests", that's what it says, we keep the lore intact. ๐)
"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.
And yes, the --state switch may be used more than once:
$ prove -b --state=hot --state=all,save
๐ --rules
The --rules option controls which tests run sequentially and which run in parallel โ but only if the --jobs option is specified. You can specify this option multiple times, and the order matters. ๐
The most practical use is probably to declare that some tests are not "parallel-ready". And since mentioning a file with --rules doesn't cause it to be selected to run as a test, you can "set and forget" some rules preferences in your .proverc file. Then you'll be able to take maximum advantage of the performance benefits of parallel testing, while some exceptions are still run in parallel.
--rules examples
# All tests are allowed to run in parallel, except those starting with "p"
--rules='seq=t/p*.t' --rules='par=**'
# All tests must run in sequence except those starting with "p", which should be run parallel
--rules='par=t/p*.t'
--rules resolution
- By default, all tests are eligible to be run in parallel. Specifying any of your own rules removes this one.
- "First match wins". The first rule that matches a test will be the one that applies.
- Any test which does not match a rule will be run in sequence at the end of the run.
- The existence of a rule does not imply selecting a test. You must still specify the tests to run.
- Specifying a rule to allow tests to run in parallel does not make them run in parallel. You still need specify the number of parallel "jobs" in your Harness object.
--rules Glob-style pattern matching
We implement our own glob-style pattern matching for --rules. Here are the supported patterns:
** is any number of characters, including /, within a pathname
* is zero or more characters within a filename/directory name
? is exactly one character within a filename/directory name
{foo,bar,baz} is any of foo, bar or baz.
\ is an escape character
More advanced specifications for parallel vs sequence run rules
If you need more advanced management of what runs in parallel vs in sequence, see the associated 'rules' documentation in TAP::Harness and TAP::Parser::Scheduler. And if what's possible directly through prove isn't sufficient, you can write your own harness to access these features directly. ๐ ๏ธ
๐ @INC
prove introduces a separation between "options passed to the perl which runs prove" and "options passed to the perl which runs tests" โ and this distinction is by design. So the perl that's 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.
But because PERL5LIB is often used during testing to add build directories to @INC, prove 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. โญ
๐จ FORMATTERS
You can load a custom TAP::Parser::Formatter:
prove --formatter MyFormatter
๐ SOURCE HANDLERS
You can load custom TAP::Parser::SourceHandlers, to change the way the parser interprets particular sources of TAP.
prove --source MyHandler --source YetAnother t
And if you want to provide config to the source, you can use:
prove --source MyCustom \
--source Perl --perl-option 'foo=bar baz' --perl-option avg=0.278 \
--source File --file-option extensions=.txt --file-option extensions=.tmp t
--source pgTAP --pgtap-option pset=format=html --pgtap-option pset=border=2
Each --$source-option option must specify a key/value pair separated by an =. If an option can take multiple values, just specify it multiple times, as with the extensions= examples above. And if the option should be a hash reference, specify the value as a second pair separated by an =, as in the pset= examples above (escape = with a backslash).
All --sources are combined into a hash, and passed to new in TAP::Harness's sources parameter. ๐ซถ
See TAP::Parser::IteratorFactory for more details on how configuration is passed to SourceHandlers.
๐งฉ 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:
prove -PMyPlugin=fou,du,fafa
Please check individual plugin documentation for more details.
๐๏ธ Available Plugins
For an up-to-date list of plugins available, please check CPAN:
<https://metacpan.org/search?q=App%3A%3AProve+Plugin>
โ๏ธ Writing Plugins
Please see "PLUGINS" in App::Prove.
And that's the whole page, bestie โ you made it to the end! ๐ This gorgeous little masterpiece is from perl v5.42.3 and it's dated 2026-11-03, so go forth and prove literally everything. Mwah! ๐
๐ฆ where this page comes from
- alpine 3.24: perl-doc 5.42.3-r0 ยท Artistic-1.0-Perl OR GPL-1.0-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms