rfbytes has asked for the wisdom of the Perl Monks concerning the following question:

Hi PerlMonks, I have a simple test file under t/. I want to display the summary afte +r running all the tests. For some reason, the summary is displayed be +fore the results of "04.pl" is displayed. How do I display the summar +y after running all the tests? ==> t/test.t #!/usr/bin/perl use strict; use warnings; use Test::More; plan tests => 4; require "/home/mydir/perl5/lib/perl5/TAP/Harness.pm"; require "/home/mydir/perl5/lib/perl5/TAP/Formatter/HTML.pm"; require "/home/mydir/perl5/lib/perl5/TAP/Parser/Aggregator.pm"; my $f = TAP::Formatter::HTML->new; $f->verbosity(-1); $f->force_inline_css(0); my %args = ( formatter => $f, merge => 1, ); my $a = TAP::Parser::Aggregator->new; my $h = TAP::Harness->new(\%args); my @files = qw[01.pl 02.pl 03.pl 04.pl]; $a->start; $h->aggregate_tests($a, @files); $a->stop; done_testing(4); my $summary = <<'END_SUMMARY'; Total Tests: %s Passed: %s Failed: %s Unexpectedly succeeded: %s END_SUMMARY printf $summary, scalar $a->total, scalar $a->passed, scalar $a->failed, scalar $a->todo_passed; ==> Output 1..4 ok 1 - First ok 1 - Second ok 1 - Third Total Tests: 4 Passed: 4 Failed: 0 Unexpectedly succeeded: 0 ok 1 - Four To run the tests, I used the 'prove' utility: /home/mydir/perl5/bin/prove -Q --formatter=TAP::Formatter::HTML > outp +ut.html
  • Comment on How do I display the summary in the generated HTML page after running all the tests.
  • Download Code

Replies are listed 'Best First'.
Re: How do I display the summary in the generated HTML page after running all the tests.
by Anonymous Monk on Apr 18, 2012 at 04:21 UTC

    To run the tests, I used the 'prove' utility:

    There is your problem. The prove utility creates its own harness, formatter .... script the prove utility, remove all the harness junk from your test program, or don't use prove to run your program

      Thanks for the response. Is it possible to generate the report with summary in HTML for option 2? If so, can you please provide more insight to this.