Debian Codegraph @

upstream/opensuse-tumbleweed/man3/TAP::Harness.3pm

raw
1 .\" -*- mode: troff; coding: utf-8 -*-
2 .\" Automatically generated by Pod::Man v6.0.2 (Pod::Simple 3.45)
3 .\"
4 .\" Standard preamble:
5 .\" ========================================================================
6 .de Sp \" Vertical space (when we can't use .PP)
7 .if t .sp .5v
8 .if n .sp
9 ..
10 .de Vb \" Begin verbatim text
11 .ft CW
12 .nf
13 .ne \\$1
14 ..
15 .de Ve \" End verbatim text
16 .ft R
17 .fi
18 ..
19 .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
20 .ie n \{\
21 . ds C` ""
22 . ds C' ""
23 'br\}
24 .el\{\
25 . ds C`
26 . ds C'
27 'br\}
28 .\"
29 .\" Escape single quotes in literal strings from groff's Unicode transform.
30 .ie \n(.g .ds Aq \(aq
31 .el .ds Aq '
32 .\"
33 .\" If the F register is >0, we'll generate index entries on stderr for
34 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
35 .\" entries marked with X<> in POD. Of course, you'll have to process the
36 .\" output yourself in some meaningful fashion.
37 .\"
38 .\" Avoid warning from groff about undefined register 'F'.
39 .de IX
40 ..
41 .nr rF 0
42 .if \n(.g .if rF .nr rF 1
43 .if (\n(rF:(\n(.g==0)) \{\
44 . if \nF \{\
45 . de IX
46 . tm Index:\\$1\t\\n%\t"\\$2"
47 ..
48 . if !\nF==2 \{\
49 . nr % 0
50 . nr F 2
51 . \}
52 . \}
53 .\}
54 .rr rF
55 .\"
56 .\" Required to disable full justification in groff 1.23.0.
57 .if n .ds AD l
58 .\" ========================================================================
59 .\"
60 .IX Title "TAP::Harness 3pm"
61 .TH TAP::Harness 3pm 2026-03-09 "perl v5.42.1" "Perl Programmers Reference Guide"
62 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
63 .\" way too many mistakes in technical documents.
64 .if n .ad l
65 .nh
66 .SH NAME
67 TAP::Harness \- Run test scripts with statistics
68 .SH VERSION
69 .IX Header "VERSION"
70 Version 3.50
71 .SH DESCRIPTION
72 .IX Header "DESCRIPTION"
73 This is a simple test harness which allows tests to be run and results
74 automatically aggregated and output to STDOUT.
75 .SH SYNOPSIS
76 .IX Header "SYNOPSIS"
77 .Vb 3
78 \& use TAP::Harness;
79 \& my $harness = TAP::Harness\->new( \e%args );
80 \& $harness\->runtests(@tests);
81 .Ve
82 .SH METHODS
83 .IX Header "METHODS"
84 .SS "Class Methods"
85 .IX Subsection "Class Methods"
86 \fR\f(CI\*(C`new\*(C'\fR\fI\fR
87 .IX Subsection "new"
88 .PP
89 .Vb 5
90 \& my %args = (
91 \& verbosity => 1,
92 \& lib => [ \*(Aqlib\*(Aq, \*(Aqblib/lib\*(Aq, \*(Aqblib/arch\*(Aq ],
93 \& )
94 \& my $harness = TAP::Harness\->new( \e%args );
95 .Ve
96 .PP
97 The constructor returns a new \f(CW\*(C`TAP::Harness\*(C'\fR object. It accepts an
98 optional hashref whose allowed keys are:
99 .IP \(bu 4
100 \&\f(CW\*(C`verbosity\*(C'\fR
101 .Sp
102 Set the verbosity level:
103 .Sp
104 .Vb 6
105 \& 1 verbose Print individual test results to STDOUT.
106 \& 0 normal
107 \& \-1 quiet Suppress some test output (mostly failures
108 \& while tests are running).
109 \& \-2 really quiet Suppress everything but the tests summary.
110 \& \-3 silent Suppress everything.
111 .Ve
112 .IP \(bu 4
113 \&\f(CW\*(C`timer\*(C'\fR
114 .Sp
115 Append run time for each test to output. Uses Time::HiRes if
116 available.
117 .IP \(bu 4
118 \&\f(CW\*(C`failures\*(C'\fR
119 .Sp
120 Show test failures (this is a no\-op if \f(CW\*(C`verbose\*(C'\fR is selected).
121 .IP \(bu 4
122 \&\f(CW\*(C`comments\*(C'\fR
123 .Sp
124 Show test comments (this is a no\-op if \f(CW\*(C`verbose\*(C'\fR is selected).
125 .IP \(bu 4
126 \&\f(CW\*(C`show_count\*(C'\fR
127 .Sp
128 Update the running test count during testing.
129 .IP \(bu 4
130 \&\f(CW\*(C`normalize\*(C'\fR
131 .Sp
132 Set to a true value to normalize the TAP that is emitted in verbose modes.
133 .IP \(bu 4
134 \&\f(CW\*(C`lib\*(C'\fR
135 .Sp
136 Accepts a scalar value or array ref of scalar values indicating which
137 paths to allowed libraries should be included if Perl tests are
138 executed. Naturally, this only makes sense in the context of tests
139 written in Perl.
140 .IP \(bu 4
141 \&\f(CW\*(C`switches\*(C'\fR
142 .Sp
143 Accepts a scalar value or array ref of scalar values indicating which
144 switches should be included if Perl tests are executed. Naturally, this
145 only makes sense in the context of tests written in Perl.
146 .IP \(bu 4
147 \&\f(CW\*(C`test_args\*(C'\fR
148 .Sp
149 A reference to an \f(CW@INC\fR style array of arguments to be passed to each
150 test program.
151 .Sp
152 .Vb 1
153 \& test_args => [\*(Aqfoo\*(Aq, \*(Aqbar\*(Aq],
154 .Ve
155 .Sp
156 if you want to pass different arguments to each test then you should
157 pass a hash of arrays, keyed by the alias for each test:
158 .Sp
159 .Vb 4
160 \& test_args => {
161 \& my_test => [\*(Aqfoo\*(Aq, \*(Aqbar\*(Aq],
162 \& other_test => [\*(Aqbaz\*(Aq],
163 \& }
164 .Ve
165 .IP \(bu 4
166 \&\f(CW\*(C`color\*(C'\fR
167 .Sp
168 Attempt to produce color output.
169 .IP \(bu 4
170 \&\f(CW\*(C`exec\*(C'\fR
171 .Sp
172 Typically, Perl tests are run through this. However, anything which
173 spits out TAP is fine. You can use this argument to specify the name of
174 the program (and optional switches) to run your tests with:
175 .Sp
176 .Vb 1
177 \& exec => [\*(Aq/usr/bin/ruby\*(Aq, \*(Aq\-w\*(Aq]
178 .Ve
179 .Sp
180 You can also pass a subroutine reference in order to determine and
181 return the proper program to run based on a given test script. The
182 subroutine reference should expect the TAP::Harness object itself as the
183 first argument, and the file name as the second argument. It should
184 return an array reference containing the command to be run and including
185 the test file name. It can also simply return \f(CW\*(C`undef\*(C'\fR, in which case
186 TAP::Harness will fall back on executing the test script in Perl:
187 .Sp
188 .Vb 2
189 \& exec => sub {
190 \& my ( $harness, $test_file ) = @_;
191 \&
192 \& # Let Perl tests run.
193 \& return undef if $test_file =~ /[.]t$/;
194 \& return [ qw( /usr/bin/ruby \-w ), $test_file ]
195 \& if $test_file =~ /[.]rb$/;
196 \& }
197 .Ve
198 .Sp
199 If the subroutine returns a scalar with a newline or a filehandle, it
200 will be interpreted as raw TAP or as a TAP stream, respectively.
201 .IP \(bu 4
202 \&\f(CW\*(C`merge\*(C'\fR
203 .Sp
204 If \f(CW\*(C`merge\*(C'\fR is true the harness will create parsers that merge STDOUT
205 and STDERR together for any processes they start.
206 .IP \(bu 4
207 \&\f(CW\*(C`sources\*(C'\fR
208 .Sp
209 \&\fINEW to 3.18\fR.
210 .Sp
211 If set, \f(CW\*(C`sources\*(C'\fR must be a hashref containing the names of the
212 TAP::Parser::SourceHandlers to load and/or configure. The values are a
213 hash of configuration that will be accessible to the source handlers via
214 "config_for" in TAP::Parser::Source.
215 .Sp
216 For example:
217 .Sp
218 .Vb 5
219 \& sources => {
220 \& Perl => { exec => \*(Aq/path/to/custom/perl\*(Aq },
221 \& File => { extensions => [ \*(Aq.tap\*(Aq, \*(Aq.txt\*(Aq ] },
222 \& MyCustom => { some => \*(Aqconfig\*(Aq },
223 \& }
224 .Ve
225 .Sp
226 The \f(CW\*(C`sources\*(C'\fR parameter affects how \f(CW\*(C`source\*(C'\fR, \f(CW\*(C`tap\*(C'\fR and \f(CW\*(C`exec\*(C'\fR parameters
227 are handled.
228 .Sp
229 For more details, see the \f(CW\*(C`sources\*(C'\fR parameter in "new" in TAP::Parser,
230 TAP::Parser::Source, and TAP::Parser::IteratorFactory.
231 .IP \(bu 4
232 \&\f(CW\*(C`aggregator_class\*(C'\fR
233 .Sp
234 The name of the class to use to aggregate test results. The default is
235 TAP::Parser::Aggregator.
236 .IP \(bu 4
237 \&\f(CW\*(C`version\*(C'\fR
238 .Sp
239 \&\fINEW to 3.22\fR.
240 .Sp
241 Assume this TAP version for TAP::Parser instead of default TAP
242 version 12.
243 .IP \(bu 4
244 \&\f(CW\*(C`formatter_class\*(C'\fR
245 .Sp
246 The name of the class to use to format output. The default is
247 TAP::Formatter::Console, or TAP::Formatter::File if the output
248 isn\*(Aqt a TTY.
249 .IP \(bu 4
250 \&\f(CW\*(C`multiplexer_class\*(C'\fR
251 .Sp
252 The name of the class to use to multiplex tests during parallel testing.
253 The default is TAP::Parser::Multiplexer.
254 .IP \(bu 4
255 \&\f(CW\*(C`parser_class\*(C'\fR
256 .Sp
257 The name of the class to use to parse TAP. The default is
258 TAP::Parser.
259 .IP \(bu 4
260 \&\f(CW\*(C`scheduler_class\*(C'\fR
261 .Sp
262 The name of the class to use to schedule test execution. The default is
263 TAP::Parser::Scheduler.
264 .IP \(bu 4
265 \&\f(CW\*(C`formatter\*(C'\fR
266 .Sp
267 If set \f(CW\*(C`formatter\*(C'\fR must be an object that is capable of formatting the
268 TAP output. See TAP::Formatter::Console for an example.
269 .IP \(bu 4
270 \&\f(CW\*(C`errors\*(C'\fR
271 .Sp
272 If parse errors are found in the TAP output, a note of this will be
273 made in the summary report. To see all of the parse errors, set this
274 argument to true:
275 .Sp
276 .Vb 1
277 \& errors => 1
278 .Ve
279 .IP \(bu 4
280 \&\f(CW\*(C`directives\*(C'\fR
281 .Sp
282 If set to a true value, only test results with directives will be
283 displayed. This overrides other settings such as \f(CW\*(C`verbose\*(C'\fR or
284 \&\f(CW\*(C`failures\*(C'\fR.
285 .IP \(bu 4
286 \&\f(CW\*(C`ignore_exit\*(C'\fR
287 .Sp
288 If set to a true value instruct \f(CW\*(C`TAP::Parser\*(C'\fR to ignore exit and wait
289 status from test scripts.
290 .IP \(bu 4
291 \&\f(CW\*(C`jobs\*(C'\fR
292 .Sp
293 The maximum number of parallel tests to run at any time. Which tests
294 can be run in parallel is controlled by \f(CW\*(C`rules\*(C'\fR. The default is to
295 run only one test at a time.
296 .IP \(bu 4
297 \&\f(CW\*(C`rules\*(C'\fR
298 .Sp
299 A reference to a hash of rules that control which tests may be executed in
300 parallel. If no rules are declared and CPAN::Meta::YAML is available,
301 \&\f(CW\*(C`TAP::Harness\*(C'\fR attempts to load rules from a YAML file specified by the
302 \&\f(CW\*(C`rulesfile\*(C'\fR parameter. If no rules file exists, the default is for all
303 tests to be eligible to be run in parallel.
304 .Sp
305 Here some simple examples. For the full details of the data structure
306 and the related glob\-style pattern matching, see
307 "Rules data structure" in TAP::Parser::Scheduler.
308 .Sp
309 .Vb 4
310 \& # Run all tests in sequence, except those starting with "p"
311 \& $harness\->rules({
312 \& par => \*(Aqt/p*.t\*(Aq
313 \& });
314 \&
315 \& # Equivalent YAML file
316 \& \-\-\-
317 \& par: t/p*.t
318 \&
319 \& # Run all tests in parallel, except those starting with "p"
320 \& $harness\->rules({
321 \& seq => [
322 \& { seq => \*(Aqt/p*.t\*(Aq },
323 \& { par => \*(Aq**\*(Aq },
324 \& ],
325 \& });
326 \&
327 \& # Equivalent YAML file
328 \& \-\-\-
329 \& seq:
330 \& \- seq: t/p*.t
331 \& \- par: **
332 \&
333 \& # Run some startup tests in sequence, then some parallel tests than some
334 \& # teardown tests in sequence.
335 \& $harness\->rules({
336 \& seq => [
337 \& { seq => \*(Aqt/startup/*.t\*(Aq },
338 \& { par => [\*(Aqt/a/*.t\*(Aq,\*(Aqt/b/*.t\*(Aq,\*(Aqt/c/*.t\*(Aq], }
339 \& { seq => \*(Aqt/shutdown/*.t\*(Aq },
340 \& ],
341 \&
342 \& });
343 \&
344 \& # Equivalent YAML file
345 \& \-\-\-
346 \& seq:
347 \& \- seq: t/startup/*.t
348 \& \- par:
349 \& \- t/a/*.t
350 \& \- t/b/*.t
351 \& \- t/c/*.t
352 \& \- seq: t/shutdown/*.t
353 .Ve
354 .Sp
355 This is an experimental feature and the interface may change.
356 .IP \(bu 4
357 \&\f(CW\*(C`rulesfiles\*(C'\fR
358 .Sp
359 This specifies where to find a YAML file of test scheduling rules. If not
360 provided, it looks for a default file to use. It first checks for a file given
361 in the \f(CW\*(C`HARNESS_RULESFILE\*(C'\fR environment variable, then it checks for
362 \&\fItestrules.yml\fR and then \fIt/testrules.yml\fR.
363 .IP \(bu 4
364 \&\f(CW\*(C`stdout\*(C'\fR
365 .Sp
366 A filehandle for catching standard output.
367 .IP \(bu 4
368 \&\f(CW\*(C`trap\*(C'\fR
369 .Sp
370 Attempt to print summary information if run is interrupted by
371 SIGINT (Ctrl\-C).
372 .PP
373 Any keys for which the value is \f(CW\*(C`undef\*(C'\fR will be ignored.
374 .SS "Instance Methods"
375 .IX Subsection "Instance Methods"
376 \fR\f(CI\*(C`runtests\*(C'\fR\fI\fR
377 .IX Subsection "runtests"
378 .PP
379 .Vb 1
380 \& $harness\->runtests(@tests);
381 .Ve
382 .PP
383 Accepts an array of \f(CW@tests\fR to be run. This should generally be the
384 names of test files, but this is not required. Each element in \f(CW@tests\fR
385 will be passed to \f(CWTAP::Parser::new()\fR as a \f(CW\*(C`source\*(C'\fR. See
386 TAP::Parser for more information.
387 .PP
388 It is possible to provide aliases that will be displayed in place of the
389 test name by supplying the test as a reference to an array containing
390 \&\f(CW\*(C`[ $test, $alias ]\*(C'\fR:
391 .PP
392 .Vb 2
393 \& $harness\->runtests( [ \*(Aqt/foo.t\*(Aq, \*(AqFoo Once\*(Aq ],
394 \& [ \*(Aqt/foo.t\*(Aq, \*(AqFoo Twice\*(Aq ] );
395 .Ve
396 .PP
397 Normally it is an error to attempt to run the same test twice. Aliases
398 allow you to overcome this limitation by giving each run of the test a
399 unique name.
400 .PP
401 Tests will be run in the order found.
402 .PP
403 If the environment variable \f(CW\*(C`PERL_TEST_HARNESS_DUMP_TAP\*(C'\fR is defined it
404 should name a directory into which a copy of the raw TAP for each test
405 will be written. TAP is written to files named for each test.
406 Subdirectories will be created as needed.
407 .PP
408 Returns a TAP::Parser::Aggregator containing the test results.
409 .PP
410 \fR\f(CI\*(C`summary\*(C'\fR\fI\fR
411 .IX Subsection "summary"
412 .PP
413 .Vb 1
414 \& $harness\->summary( $aggregator );
415 .Ve
416 .PP
417 Output the summary for a TAP::Parser::Aggregator.
418 .PP
419 \fR\f(CI\*(C`aggregate_tests\*(C'\fR\fI\fR
420 .IX Subsection "aggregate_tests"
421 .PP
422 .Vb 1
423 \& $harness\->aggregate_tests( $aggregate, @tests );
424 .Ve
425 .PP
426 Run the named tests and display a summary of result. Tests will be run
427 in the order found.
428 .PP
429 Test results will be added to the supplied TAP::Parser::Aggregator.
430 \&\f(CW\*(C`aggregate_tests\*(C'\fR may be called multiple times to run several sets of
431 tests. Multiple \f(CW\*(C`Test::Harness\*(C'\fR instances may be used to pass results
432 to a single aggregator so that different parts of a complex test suite
433 may be run using different \f(CW\*(C`TAP::Harness\*(C'\fR settings. This is useful, for
434 example, in the case where some tests should run in parallel but others
435 are unsuitable for parallel execution.
436 .PP
437 .Vb 8
438 \& my $formatter = TAP::Formatter::Console\->new;
439 \& my $ser_harness = TAP::Harness\->new( { formatter => $formatter } );
440 \& my $par_harness = TAP::Harness\->new(
441 \& { formatter => $formatter,
442 \& jobs => 9
443 \& }
444 \& );
445 \& my $aggregator = TAP::Parser::Aggregator\->new;
446 \&
447 \& $aggregator\->start();
448 \& $ser_harness\->aggregate_tests( $aggregator, @ser_tests );
449 \& $par_harness\->aggregate_tests( $aggregator, @par_tests );
450 \& $aggregator\->stop();
451 \& $formatter\->summary($aggregator);
452 .Ve
453 .PP
454 Note that for simpler testing requirements it will often be possible to
455 replace the above code with a single call to \f(CW\*(C`runtests\*(C'\fR.
456 .PP
457 Each element of the \f(CW@tests\fR array is either:
458 .IP \(bu 4
459 the source name of a test to run
460 .IP \(bu 4
461 a reference to a [ source name, display name ] array
462 .PP
463 In the case of a perl test suite, typically \fIsource names\fR are simply the file
464 names of the test scripts to run.
465 .PP
466 When you supply a separate display name it becomes possible to run a
467 test more than once; the display name is effectively the alias by which
468 the test is known inside the harness. The harness doesn\*(Aqt care if it
469 runs the same test more than once when each invocation uses a
470 different name.
471 .PP
472 \fR\f(CI\*(C`make_scheduler\*(C'\fR\fI\fR
473 .IX Subsection "make_scheduler"
474 .PP
475 Called by the harness when it needs to create a
476 TAP::Parser::Scheduler. Override in a subclass to provide an
477 alternative scheduler. \f(CW\*(C`make_scheduler\*(C'\fR is passed the list of tests
478 that was passed to \f(CW\*(C`aggregate_tests\*(C'\fR.
479 .PP
480 \fR\f(CI\*(C`jobs\*(C'\fR\fI\fR
481 .IX Subsection "jobs"
482 .PP
483 Gets or sets the number of concurrent test runs the harness is
484 handling. By default, this value is 1 \-\- for parallel testing, this
485 should be set higher.
486 .PP
487 \fR\f(CI\*(C`make_parser\*(C'\fR\fI\fR
488 .IX Subsection "make_parser"
489 .PP
490 Make a new parser and display formatter session. Typically used and/or
491 overridden in subclasses.
492 .PP
493 .Vb 1
494 \& my ( $parser, $session ) = $harness\->make_parser;
495 .Ve
496 .PP
497 \fR\f(CI\*(C`finish_parser\*(C'\fR\fI\fR
498 .IX Subsection "finish_parser"
499 .PP
500 Terminate use of a parser. Typically used and/or overridden in
501 subclasses. The parser isn\*(Aqt destroyed as a result of this.
502 .SH CONFIGURING
503 .IX Header "CONFIGURING"
504 \&\f(CW\*(C`TAP::Harness\*(C'\fR is designed to be easy to configure.
505 .SS Plugins
506 .IX Subsection "Plugins"
507 \&\f(CW\*(C`TAP::Parser\*(C'\fR plugins let you change the way TAP is \fIinput\fR to and \fIoutput\fR
508 from the parser.
509 .PP
510 TAP::Parser::SourceHandlers handle TAP \fIinput\fR. You can configure them
511 and load custom handlers using the \f(CW\*(C`sources\*(C'\fR parameter to "new".
512 .PP
513 TAP::Formatters handle TAP \fIoutput\fR. You can load custom formatters by
514 using the \f(CW\*(C`formatter_class\*(C'\fR parameter to "new". To configure a formatter,
515 you currently need to instantiate it outside of TAP::Harness and pass it in
516 with the \f(CW\*(C`formatter\*(C'\fR parameter to "new". This \fImay\fR be addressed by adding
517 a \fIformatters\fR parameter to "new" in the future.
518 .ie n .SS """Module::Build"""
519 .el .SS \f(CWModule::Build\fP
520 .IX Subsection "Module::Build"
521 Module::Build version \f(CW0.30\fR supports \f(CW\*(C`TAP::Harness\*(C'\fR.
522 .PP
523 To load \f(CW\*(C`TAP::Harness\*(C'\fR plugins, you\*(Aqll need to use the \f(CW\*(C`tap_harness_args\*(C'\fR
524 parameter to \f(CW\*(C`new\*(C'\fR, typically from your \f(CW\*(C`Build.PL\*(C'\fR. For example:
525 .PP
526 .Vb 10
527 \& Module::Build\->new(
528 \& module_name => \*(AqMyApp\*(Aq,
529 \& test_file_exts => [qw(.t .tap .txt)],
530 \& use_tap_harness => 1,
531 \& tap_harness_args => {
532 \& sources => {
533 \& MyCustom => {},
534 \& File => {
535 \& extensions => [\*(Aq.tap\*(Aq, \*(Aq.txt\*(Aq],
536 \& },
537 \& },
538 \& formatter_class => \*(AqTAP::Formatter::HTML\*(Aq,
539 \& },
540 \& build_requires => {
541 \& \*(AqModule::Build\*(Aq => \*(Aq0.30\*(Aq,
542 \& \*(AqTAP::Harness\*(Aq => \*(Aq3.18\*(Aq,
543 \& },
544 \& )\->create_build_script;
545 .Ve
546 .PP
547 See "new"
548 .ie n .SS """ExtUtils::MakeMaker"""
549 .el .SS \f(CWExtUtils::MakeMaker\fP
550 .IX Subsection "ExtUtils::MakeMaker"
551 ExtUtils::MakeMaker does not support TAP::Harness out\-of\-the\-box.
552 .ie n .SS """prove"""
553 .el .SS \f(CWprove\fP
554 .IX Subsection "prove"
555 prove supports \f(CW\*(C`TAP::Harness\*(C'\fR plugins, and has a plugin system of its
556 own. See "FORMATTERS" in prove, "SOURCE HANDLERS" in prove and App::Prove
557 for more details.
558 .SH "WRITING PLUGINS"
559 .IX Header "WRITING PLUGINS"
560 If you can\*(Aqt configure \f(CW\*(C`TAP::Harness\*(C'\fR to do what you want, and you can\*(Aqt find
561 an existing plugin, consider writing one.
562 .PP
563 The two primary use cases supported by TAP::Harness for plugins are \fIinput\fR
564 and \fIoutput\fR:
565 .IP "Customize how TAP gets into the parser" 2
566 .IX Item "Customize how TAP gets into the parser"
567 To do this, you can either extend an existing TAP::Parser::SourceHandler,
568 or write your own. It\*(Aqs a pretty simple API, and they can be loaded and
569 configured using the \f(CW\*(C`sources\*(C'\fR parameter to "new".
570 .IP "Customize how TAP results are output from the parser" 2
571 .IX Item "Customize how TAP results are output from the parser"
572 To do this, you can either extend an existing TAP::Formatter, or write your
573 own. Writing formatters are a bit more involved than writing a
574 \&\fISourceHandler\fR, as you\*(Aqll need to understand the TAP::Parser API. A
575 good place to start is by understanding how "aggregate_tests" works.
576 .Sp
577 Custom formatters can be loaded configured using the \f(CW\*(C`formatter_class\*(C'\fR
578 parameter to "new".
579 .SH SUBCLASSING
580 .IX Header "SUBCLASSING"
581 If you can\*(Aqt configure \f(CW\*(C`TAP::Harness\*(C'\fR to do exactly what you want, and writing
582 a plugin isn\*(Aqt an option, consider extending it. It is designed to be (mostly)
583 easy to subclass, though the cases when sub\-classing is necessary should be few
584 and far between.
585 .SS Methods
586 .IX Subsection "Methods"
587 The following methods are ones you may wish to override if you want to
588 subclass \f(CW\*(C`TAP::Harness\*(C'\fR.
589 .IP """new""" 4
590 .IX Item """new"""
591 .PD 0
592 .IP """runtests""" 4
593 .IX Item """runtests"""
594 .IP """summary""" 4
595 .IX Item """summary"""
596 .PD
597 .SH REPLACING
598 .IX Header "REPLACING"
599 If you like the \f(CW\*(C`prove\*(C'\fR utility and TAP::Parser but you want your
600 own harness, all you need to do is write one and provide \f(CW\*(C`new\*(C'\fR and
601 \&\f(CW\*(C`runtests\*(C'\fR methods. Then you can use the \f(CW\*(C`prove\*(C'\fR utility like so:
602 .PP
603 .Vb 1
604 \& prove \-\-harness My::Test::Harness
605 .Ve
606 .PP
607 Note that while \f(CW\*(C`prove\*(C'\fR accepts a list of tests (or things to be
608 tested), \f(CW\*(C`new\*(C'\fR has a fairly rich set of arguments. You\*(Aqll probably want
609 to read over this code carefully to see how all of them are being used.
610 .SH "SEE ALSO"
611 .IX Header "SEE ALSO"
612 Test::Harness