PROVE(1perl)
π NAME π
okay so bestie, gather round π«Ά this is prove β she runs tests through a TAP harness. that's the whole vibe. periodt. β¨
πΈ USAGE πΈ
this is literally how you summon her:
prove [options] [files or directories]
give her options, give her files, give her directories, she handles it π
β¨ OPTIONS β¨
π Boolean Options π
these are the ones you just... turn on. no arguments, no drama. on or off, that's it.
-v,--verboseβ print every single test line, no secrets kept π¬ also setsTEST_VERBOSE-l,--libβ adds'lib'to the path for your tests, iykyk (that's-Ilibenergy)-b,--blibβ addsblib/libandblib/archto the path for your tests. two for one, we love-s,--shuffleβ run the tests in random order π² chaos mode but make it productive-c,--colorβ colored test output. this is the default bestie, color is a lifestyle π--nocolorβ do not color test output. sad beige tests for sad beige people π₯²--countβ show the X/Y test count when you're not in verbose mode (default, she just does this π )--nocountβ disable the X/Y test count. numbers off, vibes on-D,--dryβ dry run. shows you the tests that would have run, like a little preview before the main character moment π-f,--failuresβ show the failed tests. spill the tea, what flopped π΅-o,--commentsβ show comments π¬--ignore-exitβ ignore the exit status from test scripts. she's not checking the door on the way out-m,--mergeβ merge test scripts' STDERR with their STDOUT. blending the streams, one big slushie π₯€-r,--recurseβ recursively descend into directories. she goes deep π₯--reverseβ run the tests in reverse order. back it up, back it up π-q,--quietβ suppress some test output while running tests. she's doing it but she's being chill about it π€«-Q,--QUIETβ only print summary results. maximum shush. the loudest silence π-p,--parseβ show the full list of TAP parse errors, if there are any. receipts, fully itemized π§Ύ--directivesβ only show results withTODOorSKIPdirectives. filtered feed, curated for you β¨--timerβ print elapsed time after each test. so you know which one was the slow one dragging the group chat β±οΈ--trapβ trap Ctrl+C and print a summary on interrupt. she catches you mid-bail and still gives you the recap π«Ά--normalizeβ normalize TAP output in verbose output. tidying the girlypop mess-Tβ enable tainting checks. security era π-tβ enable tainting warnings. security era but she's just warning you-Wβ enable fatal warnings. warnings that will literally end you π-wβ enable warnings. the gentle version, still iconic-h,--helpβ display this help. hi hello here's the tour π-?β also display this help. same help, different outfit-V,--versionβ display the version. which edition of the queen are we on π-H,--manβ the longer manpage forprove. the director's cut πΏ--norcβ don't process the default.proverc. skipping the preset, going in raw β¨
π¦ Options That Take Arguments π¦
these ones need you to hand them something. they don't work for free, bestie.
-Iβ library paths to include π-Pβ load a plugin (she searchesApp::Prove::Plugin::*for it) π-Mβ load a module π§©-e,--execβ the interpreter to run the tests with. pass''for compiled tests π--extβ set the extension for tests (default is'.t') π·οΈ--harnessβ define the test harness to use. seeTAP::Harnessπ―--formatterβ the result formatter to use. see FORMATTERS π--sourceβ load and/or configure aSourceHandler. see SOURCE HANDLERS π§-a,--archive out.tgzβ store the resulting TAP in an archive file. scrapbook it π¦-j,--jobs Nβ run N test jobs in parallel (try 9). multitasking queen, do several things badly? no β do several things slayfully β‘--state=optsβ controlprove's persistent state. she remembers π§--statefile=fileβ usefileinstead of.provefor state π--rc=rcfileβ process options from rcfile π--rulesβ rules for parallel vs sequential processing. she's got a whole system for knowing when to queue and when to run π¦
πΈ NOTES πΈ
π .proverc
okay so listen, bestie: if ~/.proverc or ./.proverc exist, they get read and any options they hold get processed before the command line options. Options in .proverc are written exactly the same way as command line options:
# .proverc
--state=hot,fast,save
-j9
You can pull in extra option files with the --rc option. And the default option file processing? Fully cancelled by --norc. π
πͺ On Windows and VMS the option file is named_provercrather than.proverc, and it's only sought in the current directory. iykyk.
π₯ Reading from STDIN
If you have a list of tests (or URLs, or literally anything else you want to test) sitting in a file, you can add them to your tests by using a -:
prove - < my_list_of_things_to_test.txt
Check the README in the examples directory of this distribution for the whole vibe. π¦
π Default Test Directory
If you don't supply any files or directories, prove looks for all files matching the pattern t/*.t. She just knows where to look. β¨
π Colored Test Output
Colored test output using TAP::Formatter::Color is the default, but if output isn't going to a terminal, color is disabled. You can override that by adding the --color switch. πΈ
Color support requires Term::ANSIColor and, on windows platforms, also Win32::Console::ANSI. If the necessary module(s) aren't installed, colored output will not be available. π
πͺ Exit Code
If the tests fail, prove will exit with non-zero status. That's it. That's the rule. π
π Arguments to Tests
You can totally 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. And when you're running multiple tests, they will each receive the same arguments. equal rights, equal args. π
π --exec
Normally you can just pass a list of Perl tests and the harness will know how to execute them. However, if your tests aren't 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 STDERR (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. not for the faint of heart, fr fr.
πͺ€ --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. she refuses to leave you hanging. π
π§ --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.
β¨ 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
If you also specify the save option, newly passing tests will be excluded from subsequent runs. we love a self-cleaning queen.
# 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. yay for consistency! π
π all
Run all tests in normal order. Multiple 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. the unfinished business list!! π
π 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. zip zip zip.
π 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
π --rules
The --rules option is used to control which tests are run sequentially and which are run in parallel, if the --jobs option is specified. The option may be specified multiple times, and the order matters. π
The most practical use is likely to specify that some tests are not "parallel-ready". 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. If what's possible directly through prove is not sufficient, you can write your own harness to access these features directly. go off, build your own. π
π @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 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. iconic behavior honestly. π
π 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
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. If the option should be a hash reference, specify the value as a second pair separated by a =, 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. π€ she has standards.
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!! πβ this one is from perl v5.44.0, dated 2026-10-17, and it's the PROVE(1perl) man page ππ go run some tests, you ate. π«Ά
π¦ where this page comes from
- arch rolling: perl 5.44.0-1 Β· Artistic-1.0-Perl AND GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms