.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "TAP::Formatter::HTML 3pm" .TH TAP::Formatter::HTML 3pm "2023-08-11" "perl v5.36.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" TAP::Formatter::HTML \- TAP Test Harness output delegate for html output .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 4 \& ## \& ## command\-line usage (alpha): \& ## \& prove \-m \-Q \-P HTML=outfile:out.html,css_uri:style.css,js_uri:foo.js,force_inline_css:0 \& \& # backwards compat usage: \& prove \-m \-Q \-\-formatter=TAP::Formatter::HTML >output.html \& \& # for more detail: \& perldoc App::Prove::Plugin::HTML \& \& ## \& ## perl usage: \& ## \& use TAP::Harness; \& \& my @tests = glob( \*(Aqt/*.t\*(Aq ); \& my $harness = TAP::Harness\->new({ formatter_class => \*(AqTAP::Formatter::HTML\*(Aq, \& merge => 1 }); \& $harness\->runtests( @tests ); \& # prints HTML to STDOUT by default \& \& # or if you really don\*(Aqt want STDERR merged in: \& my $harness = TAP::Harness\->new({ formatter_class => \*(AqTAP::Formatter::HTML\*(Aq }); \& \& # to use a custom formatter: \& my $fmt = TAP::Formatter::HTML\->new; \& $fmt\->css_uris([])\->inline_css( $my_css ) \& \->js_uris([\*(Aqhttp://mysite.com/jquery.js\*(Aq, \*(Aqhttp://mysite.com/custom.js\*(Aq]) \& \->inline_js( \*(Aq$(div.summary).hide()\*(Aq ); \& \& my $harness = TAP::Harness\->new({ formatter => $fmt, merge => 1 }); \& \& # to output HTML to a file[handle]: \& $fmt\->output_fh( $fh ); \& $fmt\->output_file( \*(Aq/tmp/foo.html\*(Aq ); \& \& # you can use your own customized templates too: \& $fmt\->template(\*(Aqcustom.tt2\*(Aq) \& \->template_processor( Template\->new ) \& \->force_inline_css(0) \& \->force_inline_js(0); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This module provides \s-1HTML\s0 output formatting for TAP::Harness (a replacement for Test::Harness. It is largely based on ideas from TAP::Test::HTMLMatrix (which was built on Test::Harness and thus had a few limitations \- hence this module). For sample output, see: .PP .PP This module is targeted at all users of automated test suites. It's meant to make reading test results easier, giving you a visual summary of your test suite and letting you drill down into individual failures (which will hopefully make testing more likely to happen at your organization ;\-). .PP The design goals are: .IP "\(bu" 4 \&\fIeasy to use\fR .Sp Once you've got your test report, it should be obvious how to use it. .IP "\(bu" 4 \&\fIhelpful\fR .Sp It should be helpful by pointing out \fIwhere\fR & \fIwhy\fR your test suite is breaking. If you've written your tests well, it should give you enough info to start tracking down the issue. .IP "\(bu" 4 \&\fIeasy to install\fR .Sp Eg: should be a clean install from \s-1CPAN,\s0 and you shouldn't need to modify your existing test suite to get up & running, though \fIyou will need to stop using Test::Harness unfortunately\fR. .IP "\(bu" 4 \&\fIwork out of the box\fR .Sp You shouldn't need to do any custom-coding to get it working \- the default configuration & templates should be enough to get started with. Once installed it should be a matter of running: .Sp .Vb 1 \& % prove \-m \-Q \-\-formatter=TAP::Formatter::HTML >output.html .Ve .Sp From your project's home dir, and opening the resulting file. .IP "\(bu" 4 \&\fIeasy to configure\fR .Sp You should be able to configure & customize it to suit your needs. As such, css, javascript and templates are all configurable. .SH "METHODS" .IX Header "METHODS" .SS "\s-1CONSTRUCTOR\s0" .IX Subsection "CONSTRUCTOR" \fInew\fR .IX Subsection "new" .PP .Vb 1 \& my $fmt = $class\->new({ %args }); .Ve .SS "\s-1ACCESSORS\s0" .IX Subsection "ACCESSORS" All chaining accessors: .PP \fIverbosity\fR .IX Subsection "verbosity" .PP .Vb 1 \& $fmt\->verbosity( [ $v ] ) .Ve .PP Verbosity level, as defined in \*(L"new\*(R" in TAP::Harness: .PP .Vb 5 \& 1 verbose Print individual test results (and more) to STDOUT. \& 0 normal \& \-1 quiet Suppress some test output (eg: test failures). \& \-2 really quiet Suppress everything to STDOUT but the HTML report. \& \-3 silent Suppress all output to STDOUT, including the HTML report. .Ve .PP Note that the report is also available via \*(L"html\*(R". You can also provide a custom \*(L"output_fh\*(R" (aka \*(L"output_file\*(R") that will be used instead of \&\*(L"stdout\*(R", even if \fIsilent\fR is on. .PP \fIstdout\fR .IX Subsection "stdout" .PP .Vb 1 \& $fmt\->stdout( [ \e*FH ] ); .Ve .PP An IO::Handle filehandle for catching standard output. Defaults to \f(CW\*(C`STDOUT\*(C'\fR. .PP \fIoutput_fh\fR .IX Subsection "output_fh" .PP .Vb 1 \& $fmt\->output_fh( [ \e*FH ] ); .Ve .PP An IO::Handle filehandle for printing the \s-1HTML\s0 report to. Defaults to the same object as \*(L"stdout\*(R". .PP \&\fBNote:\fR If \*(L"verbosity\*(R" is set to \f(CW\*(C`silent\*(C'\fR, printing to \f(CW\*(C`output_fh\*(C'\fR will still occur. (that is, assuming you've opened a different file, \fBnot\fR \&\f(CW\*(C`STDOUT\*(C'\fR). .PP \fIoutput_file\fR .IX Subsection "output_file" .PP .Vb 1 \& $fmt\->output_file( $file_name ) .Ve .PP Not strictly an accessor \- this is a shortcut for setting \*(L"output_fh\*(R", equivalent to: .PP .Vb 1 \& $fmt\->output_fh( IO::File\->new( $file_name, \*(Aqw\*(Aq ) ); .Ve .PP You can set this with the \f(CW\*(C`TAP_FORMATTER_HTML_OUTFILE=/path/to/file\*(C'\fR environment variable .PP \fIescape_output\fR .IX Subsection "escape_output" .PP .Vb 1 \& $fmt\->escape_output( [ $boolean ] ); .Ve .PP If set, all output to \*(L"stdout\*(R" is escaped. This is probably only useful if you're testing the formatter. Defaults to \f(CW0\fR. .PP \fIhtml\fR .IX Subsection "html" .PP .Vb 1 \& $fmt\->html( [ \e$html ] ); .Ve .PP This is a reference to the scalar containing the html generated on the last test run. Useful if you have \*(L"verbosity\*(R" set to \f(CW\*(C`silent\*(C'\fR, and have not provided a custom \*(L"output_fh\*(R" to write the report to. .PP \fItests\fR .IX Subsection "tests" .PP .Vb 1 \& $fmt\->tests( [ \e@test_files ] ) .Ve .PP A list of test files we're running, set by TAP::Parser. .PP \fIsession_class\fR .IX Subsection "session_class" .PP .Vb 1 \& $fmt\->session_class( [ $class ] ) .Ve .PP Class to use for TAP::Parser test sessions. You probably won't need to use this unless you're hacking or sub-classing the formatter. Defaults to TAP::Formatter::HTML::Session. .PP \fIsessions\fR .IX Subsection "sessions" .PP .Vb 1 \& $fmt\->sessions( [ \e@sessions ] ) .Ve .PP Test sessions added by TAP::Parser. You probably won't need to use this unless you're hacking or sub-classing the formatter. .PP \fItemplate_processor\fR .IX Subsection "template_processor" .PP .Vb 1 \& $fmt\->template_processor( [ $processor ] ) .Ve .PP The template processor to use. Defaults to a \s-1TT2\s0 Template processor with the following config: .PP .Vb 3 \& COMPILE_DIR => catdir( tempdir(), \*(AqTAP\-Formatter\-HTML\*(Aq ), \& COMPILE_EXT => \*(Aq.ttc\*(Aq, \& INCLUDE_PATH => parent directory TAP::Formatter::HTML was loaded from .Ve .PP Note: \s-1INCLUDE_PATH\s0 used to be set to: \f(CW\*(C`join(\*(Aq:\*(Aq, @INC)\*(C'\fR but this was causing issues on systems with > 64 dirs in \f(CW@INC\fR. See \s-1RT\s0 #74364 for details. .PP \fItemplate\fR .IX Subsection "template" .PP .Vb 1 \& $fmt\->template( [ $file_name ] ) .Ve .PP The template file to load. Defaults to \f(CW\*(C`TAP/Formatter/HTML/default_report.tt2\*(C'\fR. .PP You can set this with the \f(CW\*(C`TAP_FORMATTER_HTML_TEMPLATE=/path/to.tt\*(C'\fR environment variable. .PP \fIcss_uris\fR .IX Subsection "css_uris" .PP .Vb 1 \& $fmt\->css_uris( [ \e@uris ] ) .Ve .PP A list of \s-1URI\s0s (or strings) to include as external stylesheets in