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