1PROVE(1) Perl Programmers Reference Guide PROVE(1)
2
3
4
6 prove - Run tests through a TAP harness.
7
9 prove [options] [files or directories]
10
12 Boolean options:
13
14 -v, --verbose Print all test lines.
15 -l, --lib Add 'lib' to the path for your tests (-Ilib).
16 -b, --blib Add 'blib/lib' and 'blib/arch' to the path for your tests
17 -s, --shuffle Run the tests in random order.
18 -c, --color Colored test output (default).
19 --nocolor Do not color test output.
20 --count Show the X/Y test count when not verbose (default)
21 --nocount Disable the X/Y test count.
22 -D --dry Dry run. Show test that would have run.
23 --ext Set the extension for tests (default '.t')
24 -f, --failures Show failed tests.
25 -o, --comments Show comments.
26 --fork Fork to run harness in multiple processes.
27 --ignore-exit Ignore exit status from test scripts.
28 -m, --merge Merge test scripts' STDERR with their STDOUT.
29 -r, --recurse Recursively descend into directories.
30 --reverse Run the tests in reverse order.
31 -q, --quiet Suppress some test output while running tests.
32 -Q, --QUIET Only print summary results.
33 -p, --parse Show full list of TAP parse errors, if any.
34 --directives Only show results with TODO or SKIP directives.
35 --timer Print elapsed time after each test.
36 --normalize Normalize TAP output in verbose output
37 -T Enable tainting checks.
38 -t Enable tainting warnings.
39 -W Enable fatal warnings.
40 -w Enable warnings.
41 -h, --help Display this help
42 -?, Display this help
43 -H, --man Longer manpage for prove
44 --norc Don't process default .proverc
45
46 Options that take arguments:
47
48 -I Library paths to include.
49 -P Load plugin (searches App::Prove::Plugin::*.)
50 -M Load a module.
51 -e, --exec Interpreter to run the tests ('' for compiled tests.)
52 --harness Define test harness to use. See TAP::Harness.
53 --formatter Result formatter to use. See TAP::Harness.
54 -a, --archive Store the resulting TAP in an archive file.
55 -j, --jobs N Run N test jobs in parallel (try 9.)
56 --state=opts Control prove's persistent state.
57 --rc=rcfile Process options from rcfile
58
60 .proverc
61 If ~/.proverc or ./.proverc exist they will be read and any options
62 they contain processed before the command line options. Options in
63 .proverc are specified in the same way as command line options:
64
65 # .proverc
66 --state=hot,fast,save
67 -j9 --fork
68
69 Additional option files may be specified with the "--rc" option.
70 Default option file processing is disabled by the "--norc" option.
71
72 Under Windows and VMS the option file is named _proverc rather than
73 .proverc and is sought only in the current directory.
74
75 Reading from "STDIN"
76 If you have a list of tests (or URLs, or anything else you want to
77 test) in a file, you can add them to your tests by using a '-':
78
79 prove - < my_list_of_things_to_test.txt
80
81 See the "README" in the "examples" directory of this distribution.
82
83 Default Test Directory
84 If no files or directories are supplied, "prove" looks for all files
85 matching the pattern "t/*.t".
86
87 Colored Test Output
88 Colored test output is the default, but if output is not to a terminal,
89 color is disabled. You can override this by adding the "--color"
90 switch.
91
92 Color support requires Term::ANSIColor on Unix-like platforms and
93 Win32::Console windows. If the necessary module is not installed
94 colored output will not be available.
95
96 Exit Code
97 If the tests fail "prove" will exit with non-zero status.
98
99 Arguments to Tests
100 It is possible to supply arguments to tests. To do so separate them
101 from prove's own arguments with the arisdottle, '::'. For example
102
103 prove -v t/mytest.t :: --url http://example.com
104
105 would run t/mytest.t with the options '--url http://example.com'. When
106 running multiple tests they will each receive the same arguments.
107
108 "--exec"
109 Normally you can just pass a list of Perl tests and the harness will
110 know how to execute them. However, if your tests are not written in
111 Perl or if you want all tests invoked exactly the same way, use the
112 "-e", or "--exec" switch:
113
114 prove --exec '/usr/bin/ruby -w' t/
115 prove --exec '/usr/bin/perl -Tw -mstrict -Ilib' t/
116 prove --exec '/path/to/my/customer/exec'
117
118 "--merge"
119 If you need to make sure your diagnostics are displayed in the correct
120 order relative to test results you can use the "--merge" option to
121 merge the test scripts' STDERR into their STDOUT.
122
123 This guarantees that STDOUT (where the test results appear) and STDOUT
124 (where the diagnostics appear) will stay in sync. The harness will
125 display any diagnostics your tests emit on STDERR.
126
127 Caveat: this is a bit of a kludge. In particular note that if anything
128 that appears on STDERR looks like a test result the test harness will
129 get confused. Use this option only if you understand the consequences
130 and can live with the risk.
131
132 "--state"
133 You can ask "prove" to remember the state of previous test runs and
134 select and/or order the tests to be run based on that saved state.
135
136 The "--state" switch requires an argument which must be a comma
137 separated list of one or more of the following options.
138
139 "last"
140 Run the same tests as the last time the state was saved. This makes
141 it possible, for example, to recreate the ordering of a shuffled
142 test.
143
144 # Run all tests in random order
145 $ prove -b --state=save --shuffle
146
147 # Run them again in the same order
148 $ prove -b --state=last
149
150 "failed"
151 Run only the tests that failed on the last run.
152
153 # Run all tests
154 $ prove -b --state=save
155
156 # Run failures
157 $ prove -b --state=failed
158
159 If you also specify the "save" option newly passing tests will be
160 excluded from subsequent runs.
161
162 # Repeat until no more failures
163 $ prove -b --state=failed,save
164
165 "passed"
166 Run only the passed tests from last time. Useful to make sure that
167 no new problems have been introduced.
168
169 "all"
170 Run all tests in normal order. Multple options may be specified, so
171 to run all tests with the failures from last time first:
172
173 $ prove -b --state=failed,all,save
174
175 "hot"
176 Run the tests that most recently failed first. The last failure
177 time of each test is stored. The "hot" option causes tests to be
178 run in most-recent- failure order.
179
180 $ prove -b --state=hot,save
181
182 Tests that have never failed will not be selected. To run all tests
183 with the most recently failed first use
184
185 $ prove -b --state=hot,all,save
186
187 This combination of options may also be specified thus
188
189 $ prove -b --state=adrian
190
191 "todo"
192 Run any tests with todos.
193
194 "slow"
195 Run the tests in slowest to fastest order. This is useful in
196 conjunction with the "-j" parallel testing switch to ensure that
197 your slowest tests start running first.
198
199 $ prove -b --state=slow -j9
200
201 "fast"
202 Run test tests in fastest to slowest order.
203
204 "new"
205 Run the tests in newest to oldest order based on the modification
206 times of the test scripts.
207
208 "old"
209 Run the tests in oldest to newest order.
210
211 "fresh"
212 Run those test scripts that have been modified since the last test
213 run.
214
215 "save"
216 Save the state on exit. The state is stored in a file called .prove
217 (_prove on Windows and VMS) in the current directory.
218
219 The "--state" switch may be used more than once.
220
221 $ prove -b --state=hot --state=all,save
222
223 @INC
224 prove introduces a separation between "options passed to the perl which
225 runs prove" and "options passed to the perl which runs tests"; this
226 distinction is by design. Thus the perl which is running a test starts
227 with the default @INC. Additional library directories can be added via
228 the "PERL5LIB" environment variable, via -Ifoo in "PERL5OPT" or via the
229 "-Ilib" option to prove.
230
231 Taint Mode
232 Normally when a Perl program is run in taint mode the contents of the
233 "PERL5LIB" environment variable do not appear in @INC.
234
235 Because "PERL5LIB" is often used during testing to add build
236 directories to @INC prove (actually TAP::Parser::Source::Perl) passes
237 the names of any directories found in "PERL5LIB" as -I switches. The
238 net effect of this is that "PERL5LIB" is honoured even when prove is
239 run in taint mode.
240
242 Plugins can be loaded using the "-Pplugin" syntax, eg:
243
244 prove -PMyPlugin
245
246 This will search for a module named "App::Prove::Plugin::MyPlugin", or
247 failing that, "MyPlugin". If the plugin can't be found, "prove" will
248 complain & exit.
249
250 You can pass arguments to your plugin by appending "=arg1,arg2,etc" to
251 the plugin name:
252
253 prove -PMyPlugin=fou,du,fafa
254
255 Please check individual plugin documentation for more details.
256
257 Available Plugins
258 For an up-to-date list of plugins available, please check CPAN:
259
260 <http://search.cpan.org/search?query=App%3A%3AProve+Plugin>
261
262 Writing Plugins
263 Please see "PLUGINS" in App::Prove.
264
265
266
267perl v5.12.4 2011-11-04 PROVE(1)