Run tests through a TAP harness.


Header "USAGE" 1 prove [options] [files or directories]


Header "OPTIONS" Boolean options:

10 -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. -f, --failures Show failed tests. -o, --comments Show comments. --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. --trap Trap Ctrl -C and print summary on interrupt. --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 -V, --version Display the version -H, --man Longer manpage for prove --norc Don (Aqt process default .proverc

Options that take arguments:

10 -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.) --ext Set the extension for tests (default (Aq.t (Aq) --harness Define test harness to use. See TAP::Harness. --formatter Result formatter to use. See FORMATTERS. --source Load and/or configure a SourceHandler. See SOURCE HANDLERS. -a, --archive out.tgz 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. --statefile=file Use file instead of .prove for state --rc=rcfile Process options from rcfile --rules Rules for parallel vs sequential processing.


Header "NOTES"


Subsection ".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:

3 # .proverc --state=hot,fast,save -j9

Additional option files may be specified with the CW(C` --rc (C' option. Default option file processing is disabled by the CW(C` --norc (C' option.

Under Windows and VMSthe option file is named _proverc rather than .proverc and is sought only in the current directory. Subsection "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 ' -':

1 prove -< my_list_of_things_to_test.txt

See the CW(C`README (C' in the CW(C`examples (C' directory of this distribution.

Default Test Directory

Subsection "Default Test Directory" If no files or directories are supplied, CW(C`prove (C' looks for all files matching the pattern CW(C`t/*.t (C' .

Colored Test Output

Subsection "Colored Test Output" Colored test output using TAP::Formatter::Color is the default, but if output is not to a terminal, color is disabled. You can override this by adding the CW(C` --color (C' switch.

Color support requires Term::ANSIColor and, on windows platforms, also Win32::Console::ANSI. If the necessary module(s) are not installed colored output will not be available.

Exit Code

Subsection "Exit Code" If the tests fail CW(C`prove (C' will exit with non-zero status.

Arguments to Tests

Subsection "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

1 prove -v t/mytest.t :: --url

would run t/mytest.t with the options ' --url'. When running multiple tests they will each receive the same arguments. Subsection "--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 CW(C` -e (C' ,or CW(C` --exec (C' switch:

3 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 Subsection "--merge" If you need to make sure your diagnostics are displayed in the correct order relative to test results you can use the CW(C` --merge (C' option to merge the test scripts' STDERRinto 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 STDERRlooks 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. Subsection "--trap" The CW(C` --trap (C' option will attempt to trap SIGINT(Ctrl-C) during a test run and display the test summary even if the run is interrupted Subsection "--state" You can ask CW(C`prove (C' to remember the state of previous test runs and select and/or order the tests to be run based on that saved state.

The CW(C` --state (C' switch requires an argument which must be a comma separated list of one or more of the following options. Item "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. 2 # Run all tests in random order $ prove -b --state=save --shuffle # Run them again in the same order $ prove -b --state=last Item "failed" Run only the tests that failed on the last run. 2 # Run all tests $ prove -b --state=save # Run failures $ prove -b --state=failed If you also specify the CW(C`save (C' option newly passing tests will be excluded from subsequent runs. 2 # Repeat until no more failures $ prove -b --state=failed,save Item "passed" Run only the passed tests from last time. Useful to make sure that no new problems have been introduced. Item "all" Run all tests in normal order. Multple options may be specified, so to run all tests with the failures from last time first: 1 $ prove -b --state=failed,all,save Item "hot" Run the tests that most recently failed first. The last failure time of each test is stored. The CW(C`hot (C' option causes tests to be run in most -recent - failure order. 1 $ 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 1 $ prove -b --state=hot,all,save This combination of options may also be specified thus 1 $ prove -b --state=adrian Item "todo" Run any tests with todos. Item "slow" Run the tests in slowest to fastest order. This is useful in conjunction with the CW(C` -j (C' parallel testing switch to ensure that your slowest tests start running first. 1 $ prove -b --state=slow -j9 Item "fast" Run test tests in fastest to slowest order. Item "new" Run the tests in newest to oldest order based on the modification times of the test scripts. Item "old" Run the tests in oldest to newest order. Item "fresh" Run those test scripts that have been modified since the last test run. Item "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 CW(C` --state (C' switch may be used more than once.

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

" --rules"

Subsection "--rules" The CW(C` --rules (C' option is used to control which tests are run sequentially and which are run in parallel, if the CW(C` --jobs (C' 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 (L"parallel-ready (R". Since mentioning a file with --rules doesn't cause it to be selected to run as a test, you can (L"set and forget (R" 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 Subsection "--rules examples"

2 # All tests are allowed to run in parallel, except those starting with "p" --rules= (Aqseq=t/p*.t (Aq --rules= (Aqpar=** (Aq # All tests must run in sequence except those starting with "p", which should be run parallel --rules= (Aqpar=t/p*.t (Aq

--rules resolution Subsection "--rules resolution"

" 4 By default, all tests are eligible to be run in parallel. Specifying any of your own rules removes this one.

" 4 (L"First match wins (R". The first rule that matches a test will be the one that applies.

" 4 Any test which does not match a rule will be run in sequence at the end of the run.

" 4 The existence of a rule does not imply selecting a test. You must still specify the tests to run.

" 4 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 CW(C`jobs (C' in your Harness object.

--rules Glob-style pattern matching Subsection "--rules Glob-style pattern matching"

We implement our own glob-style pattern matching for --rules. Here are the supported patterns:

5 ** 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

Moreadvanced specifications for parallel vs sequence run rules Subsection "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 CW(C`prove (C' is not sufficient, you can write your own harness to access these features directly. Subsection "@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 CW@INC .Additional library directories can be added via the CW(C`PERL5LIB (C' environment variable, via -Ifoo in CW(C`PERL5OPT (C' or via the CW(C` -Ilib (C' option to prove .

Taint Mode

Subsection "Taint Mode" Normally when a Perl program is run in taint mode the contents of the CW(C`PERL5LIB (C' environment variable do not appear in CW@INC .

Because CW(C`PERL5LIB (C' is often used during testing to add build directories to CW@INC prove passes the names of any directories found in CW(C`PERL5LIB (C' as -I switches. The net effect of this is that CW(C`PERL5LIB (C' is honoured even when prove is run in taint mode.


Header "FORMATTERS" You can load a custom TAP::Parser::Formatter:

1 prove --formatter MyFormatter


Header "SOURCE HANDLERS" You can load custom TAP::Parser::SourceHandlers, to change the way the parser interprets particular sources of TAP.

1 prove --source MyHandler --source YetAnother t

If you want to provide config to the source you can use:

4 prove --source MyCustom \ --source Perl --perl -option (Aqfoo=bar baz (Aq --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 CW(C` --$source -option (C' option must specify a key/value pair separated by an CW(C`= (C' .If an option can take multiple values, just specify it multiple times, as with the CW(C`extensions= (C' examples above. If the option should be a hash reference, specify the value as a second pair separated by a CW(C`= (C' ,as in the CW(C`pset= (C' examples above (escape CW(C`= (C' with a backslash).

All CW(C` --sources (C' are combined into a hash, and passed to (L"new (R" in TAP::Harness's CW(C`sources (C' parameter.

See TAP::Parser::IteratorFactory for more details on how configuration is passed to SourceHandlers .


Header "PLUGINS" Plugins can be loaded using the CW(C` -P CIplugin CW(C' syntax, eg:

1 prove -PMyPlugin

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

You can pass arguments to your plugin by appending CW(C`=arg1,arg2,etc (C' to the plugin name:

1 prove -PMyPlugin=fou,du,fafa

Please check individual plugin documentation for more details.

Available Plugins

Subsection "Available Plugins" For an up-to-date list of plugins available, please check CPAN:


Writing Plugins

Subsection "Writing Plugins" Please see (L" PLUGINS(R" in App::Prove.

Copied to clipboard
free 100$ digital ocean credit