1TAP::Harness::JUnit(3)User Contributed Perl DocumentationTAP::Harness::JUnit(3)
2
3
4
6 TAP::Harness::JUnit - Generate JUnit compatible output from TAP results
7
9 use TAP::Harness::JUnit;
10 my $harness = TAP::Harness::JUnit->new({
11 xmlfile => 'output.xml',
12 package => 'database',
13 # ...
14 });
15 $harness->runtests(@tests);
16
18 The only difference between this module and TAP::Harness is that this
19 module adds the optional arguments 'xmlfile', 'package', and
20 'namemangle' that cause the output to be formatted into XML in a format
21 similar to the one that is produced by the JUnit testing framework.
22
24 This module inherits all functions from TAP::Harness.
25
26 new
27 These options are added (compared to TAP::Harness):
28
29 xmlfile
30 Name of the file XML output will be saved to. If this argument is
31 omitted, the default of "junit_output.xml" is used and a warning is
32 issued.
33
34 Alternatively, the name of the output file can be specified in the
35 $JUNIT_OUTPUT_FILE environment variable
36
37 package
38 The Hudson/Jenkins continuous-integration systems support
39 separating test results into "packages". By default any number of
40 output xml files will be merged into the default package "(root)".
41
42 Setting a package name will place all test results from the current
43 run into that package. You can also set the environment variable
44 $JUNIT_PACKAGE to do the same.
45
46 notimes (DEPRECATED)
47 If provided (and true), test case times will not be recorded.
48
49 namemangle
50 Specify how to mangle testcase names. This is sometimes required to
51 interact with buggy JUnit consumers that lack sufficient
52 validation.
53
54 Alternatively, this value can be set in the environment variable
55 $JUNIT_NAME_MANGLE.
56
57 Available values are:
58
59 hudson
60 Replace anything but alphanumeric characters with underscores.
61 This is the default for historic reasons.
62
63 perl (RECOMMENDED)
64 Replace slashes in the directory hierarchy with dots so that
65 the filesystem layout resembles a Java class hierarchy.
66
67 This is the recommended setting and may become the default in
68 future.
69
70 none
71 Do not perform any transformations.
72
74 The name of the output file can be specified in the $JUNIT_OUTPUT_FILE
75 environment variable
76
77 The package name that Hudson/Jenkins use to categorise test results can
78 be specified in $JUNIT_PACKAGE.
79
80 The name mangling mechanism used to rewrite test names can be specified
81 in $JUNIT_NAME_MANGLE. (See namemangle documentation for available
82 values.)
83
85 TAP::Formatter::JUnit at
86 <https://metacpan.org/pod/TAP::Formatter::JUnit>
87
88 The JUnit XML schema was obtained from
89 <http://jra1mw.cvs.cern.ch:8180/cgi-bin/jra1mw.cgi/org.glite.testing.unit/config/JUnitXSchema.xsd?view=markup>.
90
92 This module was partly inspired by Michael Peters's
93 TAP::Harness::Archive. It was originally written by Lubomir Rintel
94 (GoodData) "<lubo.rintel@gooddata.com>" and includes code from several
95 contributors.
96
97 The following people (in no specific order) have reported problems or
98 contributed code to TAP::Harness::JUnit:
99
100 David Ritter
101 Jeff Lavallee
102 Andreas Pohl
103 Ton Voon
104 Kevin Goess
105 Richard Huxton
106 David E. Wheeler
107 Malcolm Parsons
108 Finn Smith
109 Toby Broyles
110
112 The comments that are above the "ok" or "not ok" are considered the
113 output of the test. This, though being more logical, is against TAP
114 specification.
115
116 XML::Simple is used to generate the output. This is suboptimal and
117 involves some hacks.
118
119 During testing the resulting files are not tested against the schema.
120 This would be a good thing to do.
121
123 Source code for TAP::Harness::JUnit is kept in a public Git repository.
124 Visit <https://github.com/jlavallee/tap-harness-junit>.
125
126 Bug reports and feature enhancement requests are tracked at
127 <https://rt.cpan.org/Public/Dist/Display.html?Name=TAP-Harness-JUnit>.
128
130 Copyright 2008, 2009, 2010, 2011, 2012, 2013 TAP::Harness::JUnit
131 contributors. All rights reserved.
132
133 This program is free software; you can redistribute it and/or modify it
134 under the same terms as Perl itself.
135
136
137
138perl v5.36.0 2022-07-22 TAP::Harness::JUnit(3)