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 ...
13 });
14 $harness->runtests(@tests);
15
17 The only difference between this module and TAP::Harness is that this
18 adds optional 'xmlfile' argument, that causes the output to be
19 formatted into XML in format similar to one that is produced by JUnit
20 testing framework.
21
23 This modules inherits all functions from TAP::Harness.
24
25 new
26 These options are added (compared to TAP::Harness):
27
28 xmlfile
29 Name of the file XML output will be saved to. In case this
30 argument is ommited, default of "junit_output.xml" is used and a
31 warning is issued.
32
33 notimes (DEPRECATED)
34 If provided (and true), test case times will not be recorded.
35
36 namemangle
37 Specify how to mangle testcase names. This is sometimes required to
38 interact with buggy JUnit consumers that lack sufficient
39 validation. Available values are:
40
41 hudson
42 Replace anything but alphanumeric characters with underscores.
43 This is default for historic reasons.
44
45 perl (RECOMMENDED)
46 Replace slashes in directory hierarchy with dots so that the
47 filesystem layout resemble Java class hierarchy.
48
49 This is the recommended setting and may become a default in
50 future.
51
52 none
53 Do not do any transformations.
54
56 JUnit XML schema was obtained from
57 http://jra1mw.cvs.cern.ch:8180/cgi-bin/jra1mw.cgi/org.glite.testing.unit/config/JUnitXSchema.xsd?view=markup
58 <http://jra1mw.cvs.cern.ch:8180/cgi-
59 bin/jra1mw.cgi/org.glite.testing.unit/config/JUnitXSchema.xsd?view=markup>.
60
62 This module was partly inspired by Michael Peters'
63 TAP::Harness::Archive.
64
65 Following people (in no specific order) have reported problems or
66 contributed fixes to TAP::Harness::JUnit:
67
68 David Ritter
69 Jeff Lavallee
70 Andreas Pohl
71
73 Test return value is ignored. This is actually not a bug, TAP::Parser
74 doesn't present the fact and TAP specification does not require that
75 anyway.
76
77 Note that this may be a problem when running Test::More tests with
78 "no_plan", since it will add a plan matching the number of tests
79 actually run even in case the test dies. Do not do that -- always write
80 a plan! In case it's not possible, pass "merge" argument when creating
81 a TAP::Harness::JUnit instance, and the harness will detect such
82 failures by matching certain comments.
83
84 Test durations are not mesaured. Unless the "notimes" parameter is
85 provided (and true), the test duration is recorded as testcase duration
86 divided by number of tests, otherwise it's set to 0 seconds. This could
87 be addressed if the module was reimplmented as a formatter.
88
89 The comments that are above the "ok" or "not ok" are considered the
90 output of the test. This, though being more logical, is against TAP
91 specification.
92
93 XML::Simple is used to generate the output. It is suboptimal and
94 involves some hacks.
95
96 During testing, the resulting files are not tested against the schema,
97 which would be a good thing to do.
98
100 Lubomir Rintel (Good Data) "<lubo.rintel@gooddata.com>"
101
102 Source code for TAP::Harness::JUnit is kept in a public GIT repository.
103 Visit http://repo.or.cz/w/TAP-Harness-JUnit.git
104 <http://repo.or.cz/w/TAP-Harness-JUnit.git> to get it.
105
107 Copyright 2008, 2009 Good Data, All rights reserved.
108
109 This program is free software; you can redistribute it and/or modify it
110 under the same terms as Perl itself.
111
112
113
114perl v5.12.0 2010-05-06 TAP::Harness::JUnit(3)