| 1 |
NAME |
| 2 |
|
| 3 |
TAP::Formatter::JUnit - Harness output delegate for JUnit output |
| 4 |
|
| 5 |
SYNOPSIS |
| 6 |
|
| 7 |
On the command line, with prove: |
| 8 |
|
| 9 |
$ prove --formatter TAP::Formatter::JUnit ... |
| 10 |
|
| 11 |
Or, in your own scripts: |
| 12 |
|
| 13 |
use TAP::Harness; |
| 14 |
|
| 15 |
# What TAP output did we save from a previous run, with |
| 16 |
# PERL_TEST_HARNESS_DUMP_TAP=tap/ |
| 17 |
my @tests = glob("tap/*.t"); |
| 18 |
|
| 19 |
# Convert the TAP to JUnit |
| 20 |
my $harness = TAP::Harness->new( { |
| 21 |
formatter_class => 'TAP::Formatter::JUnit', |
| 22 |
merge => 1, |
| 23 |
} ); |
| 24 |
$harness->runtests(@tests); |
| 25 |
|
| 26 |
DESCRIPTION |
| 27 |
|
| 28 |
This code is currently in alpha state and is subject to change. |
| 29 |
|
| 30 |
TAP::Formatter::JUnit provides JUnit output formatting for |
| 31 |
TAP::Harness. |
| 32 |
|
| 33 |
By default (e.g. when run with prove), the entire test suite is |
| 34 |
gathered together into a single JUnit XML document, which is then |
| 35 |
displayed on STDOUT. You can, however, have individual JUnit XML files |
| 36 |
dumped for each individual test, by setting PERL_TEST_HARNESS_DUMP_TAP |
| 37 |
to a directory that you would like the JUnit XML dumped to. Note, that |
| 38 |
this will also cause TAP::Harness to dump the original TAP output into |
| 39 |
that directory as well (but IMHO that's ok as you've now got the data |
| 40 |
in two parseable formats). |
| 41 |
|
| 42 |
Timing information is included in the JUnit XML, if you specified |
| 43 |
--timer when you ran prove. |
| 44 |
|
| 45 |
In standard use, a "passing TODO" is treated as failure conditions (and |
| 46 |
is reported as such in the generated JUnit). If you wish to treat these |
| 47 |
as a "pass" and not a "fail" condition, setting ALLOW_PASSING_TODOS in |
| 48 |
your environment will turn these into pass conditions. |
| 49 |
|
| 50 |
The JUnit output generated is partial to being grokked by Hudson |
| 51 |
(http://hudson.dev.java.net/). That's the build tool I'm using at the |
| 52 |
moment and needed to be able to generate JUnit output for. |
| 53 |
|
| 54 |
ATTRIBUTES |
| 55 |
|
| 56 |
testsuites |
| 57 |
|
| 58 |
List-ref of test suites that have been executed. |
| 59 |
|
| 60 |
xml |
| 61 |
|
| 62 |
An XML::Generator instance, to be used to generate XML output. |
| 63 |
|
| 64 |
METHODS |
| 65 |
|
| 66 |
open_test($test, $parser) |
| 67 |
|
| 68 |
Over-ridden open_test() method. |
| 69 |
|
| 70 |
Creates a TAP::Formatter::JUnit::Session session, instead of a |
| 71 |
console formatter session. |
| 72 |
|
| 73 |
summary() |
| 74 |
|
| 75 |
Prints the summary report (in JUnit) after all tests are run. |
| 76 |
|
| 77 |
add_testsuite($suite) |
| 78 |
|
| 79 |
Adds the given XML test $suite to the list of test suites that we've |
| 80 |
executed and need to summarize. |
| 81 |
|
| 82 |
AUTHOR |
| 83 |
|
| 84 |
Graham TerMarsch <[email protected]> |
| 85 |
|
| 86 |
Many thanks to Andy Armstrong and all those involved for the fabulous |
| 87 |
set of tests in Test::Harness; they became the basis for the unit tests |
| 88 |
here. |
| 89 |
|
| 90 |
Other thanks go out to those that have provided feedback, comments, or |
| 91 |
patches: |
| 92 |
|
| 93 |
Mark Aufflick |
| 94 |
Joe McMahon |
| 95 |
Michael Nachbaur |
| 96 |
Marc Abramowitz |
| 97 |
Colin Robertson |
| 98 |
Phillip Kimmey |
| 99 |
Dave Lambley |
| 100 |
|
| 101 |
COPYRIGHT |
| 102 |
|
| 103 |
Copyright 2008-2010, Graham TerMarsch. All Rights Reserved. |
| 104 |
|
| 105 |
This is free software; you can redistribute it and/or modify it under |
| 106 |
the same terms as Perl itself. |
| 107 |
|
| 108 |
SEE ALSO |
| 109 |
|
| 110 |
TAP::Formatter::Console |
| 111 |
|
| 112 |
TAP::Formatter::JUnit::Session |
| 113 |
|
| 114 |
Hudson home page <http://hudson.dev.java.net/> |
| 115 |
|
| 116 |
JUnitXSchema.xsd |
| 117 |
<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> |
| 118 |
|
| 119 |
JUnit parsing in Bamboo |
| 120 |
<http://confluence.atlassian.com/display/BAMBOO/JUnit+parsing+in+Bamboo>. |
| 121 |
|