TAP::Formatter::JUnit - Harness output delegate for JUnit output
Contents
Attributes
testsuites
List-ref of test suites that have been executed.
xml An "XML::Generator" instance, to be used to generate XML output.
Copyright
Copyright 2008-2010, Graham TerMarsch. All Rights Reserved.
This is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Description
Thiscodeiscurrentlyinalphastateandissubjecttochange.
"TAP::Formatter::JUnit" provides JUnit output formatting for "TAP::Harness".
By default (e.g. when run with prove), the entire test suite is gathered together into a single JUnit XML
document, which is then displayed on "STDOUT". You can, however, have individual JUnit XML files dumped
for each individual test, by setting "PERL_TEST_HARNESS_DUMP_TAP" to a directory that you would like the
JUnit XML dumped to. Note, that this will also cause "TAP::Harness" to dump the original TAP output into
that directory as well (but IMHO that's ok as you've now got the data in two parseable formats).
Timing information is included in the JUnit XML, if you specified "--timer" when you ran prove.
In standard use, a "passing TODO" is treated as failure conditions (and is reported as such in the
generated JUnit). If you wish to treat these as a "pass" and not a "fail" condition, setting
"ALLOW_PASSING_TODOS" in your environment will turn these into pass conditions.
The JUnit output generated is partial to being grokked by Hudson (<http://hudson.dev.java.net/>). That's
the build tool I'm using at the moment and needed to be able to generate JUnit output for.
Methods
open_test($test, $parser)
Over-ridden open_test() method.
Creates a "TAP::Formatter::JUnit::Session" session, instead of a console formatter session.
summary()
Prints the summary report (in JUnit) after all tests are run.
add_testsuite($suite)
Adds the given XML test $suite to the list of test suites that we've executed and need to summarize.
Name
TAP::Formatter::JUnit - Harness output delegate for JUnit output
See Also
TAP::Formatter::Console
TAP::Formatter::JUnit::Session
Hudson home page <http://hudson.dev.java.net/>
JUnitXSchema.xsd <http://jra1mw.cvs.cern.ch:8180/cgi-
bin/jra1mw.cgi/org.glite.testing.unit/config/JUnitXSchema.xsd?view=markup&content-
type=text%2Fvnd.viewcvs-markup&revision=HEAD>
JUnit parsing in Bamboo <http://confluence.atlassian.com/display/BAMBOO/JUnit+parsing+in+Bamboo>.
perl v5.40.0 2025-02-07 TAP::Formatter::JUnit(3pm)
Synopsis
On the command line, with prove:
$ prove --formatter TAP::Formatter::JUnit ...
Or, in your own scripts:
use TAP::Harness;
# What TAP output did we save from a previous run, with
# PERL_TEST_HARNESS_DUMP_TAP=tap/
my @tests = glob("tap/*.t");
# Convert the TAP to JUnit
my $harness = TAP::Harness->new( {
formatter_class => 'TAP::Formatter::JUnit',
merge => 1,
} );
$harness->runtests(@tests);
