TAP::H...::JUnit(3pm)

πŸ’– TAP::Harness::JUnit β€” the manual, but make it bestie-friendly πŸ’–

okay so this page is from the User Contributed Perl Documentation for TAP::H...::JUnit(3pm) (the full name is TAP::Harness::JUnit, they just squished it in the header, iykyk). anyway bestie, let's get into it 🫢


✨ NAME ✨

TAP::Harness::JUnit β€” literally generates JUnit-compatible output from your TAP results. that's the whole vibe. πŸŽ€


✨ SYNOPSIS ✨

use TAP::Harness::JUnit;
my $harness = TAP::Harness::JUnit->new({
    xmlfile => 'output.xml',
    package => 'database',
    # ...
});
$harness->runtests(@tests);

like, that's it. that's the whole thing. slay πŸ’…


✨ DESCRIPTION ✨

so the only difference between this module and TAP::Harness is that this one adds the optional arguments 'xmlfile', 'package', and 'namemangle' β€” and those make the output get formatted into XML in a format similar to the one produced by the JUnit testing framework. no cap, that's the entire plot. 🌸


✨ METHODS ✨

this module inherits all functions from TAP::Harness. all of them. every single one. πŸ‘‘

🌟 new

these options are added (compared to TAP::Harness):

  • xmlfile β€” the name of the file the XML output will be saved to. if you omit this argument, the default of "junit_output.xml" is used and a warning is issued (yes, it will yell at you, lovingly). alternatively, you can specify the name of the output file in the $JUNIT_OUTPUT_FILE environment variable. πŸ—‚οΈ
  • package β€” the Hudson/Jenkins continuous-integration systems support separating test results into "packages". by default any number of output xml files will be merged into the default package "(root)". setting a package name will place all test results from the current run into that package. you can also set the environment variable $JUNIT_PACKAGE to do the same. πŸ“¦
  • notimes (DEPRECATED) β€” if provided (and true), test case times will not be recorded. it's deprecated bestie, so like… be aware. πŸ’€
  • namemangle β€” specify how to mangle testcase names. this is sometimes required to interact with buggy JUnit consumers that lack sufficient validation (not their fault, but also kind of their fault πŸ™ˆ). alternatively, this value can be set in the environment variable $JUNIT_NAME_MANGLE.

available values are:

  • hudson β€” replace anything but alphanumeric characters with underscores. this is the default for historic reasons.
  • perl (RECOMMENDED) β€” replace slashes in the directory hierarchy with dots so that the filesystem layout resembles a Java class hierarchy. this is the recommended setting and may become the default in future. πŸ‘‘βœ¨
  • none β€” do not perform any transformations. zero notes. just vibes. πŸ¦‹

✨ ENVIRONMENT VARIABLES ✨

  • the name of the output file can be specified in the $JUNIT_OUTPUT_FILE environment variable. πŸ—‚οΈ
  • the package name that Hudson/Jenkins use to categorise test results can be specified in $JUNIT_PACKAGE. πŸ“¦
  • the name mangling mechanism used to rewrite test names can be specified in $JUNIT_NAME_MANGLE. (see the namemangle documentation for available values.) πŸŽ€

✨ SEE ALSO ✨


✨ ACKNOWLEDGEMENTS ✨

this module was partly inspired by Michael Peters's TAP::Harness::Archive. it was originally written by Lubomir Rintel (GoodData) "<lubo.rintel@gooddata.com>" and includes code from several contributors. 🫢

the following people (in no specific order) have reported problems or contributed code to TAP::Harness::JUnit:

  • David Ritter
  • Jeff Lavallee
  • Andreas Pohl
  • Ton Voon
  • Kevin Goess
  • Richard Huxton
  • David E. Wheeler
  • Malcolm Parsons
  • Finn Smith
  • Toby Broyles

✨ BUGS ✨

okay so the known issues, and we're being honest here:

  • the comments that are above the "ok" or "not ok" are considered the output of the test. this, though being more logical, is against TAP specification. 😭
  • XML::Simple is used to generate the output. this is suboptimal and involves some hacks. πŸ’€
  • during testing the resulting files are not tested against the schema. this would be a good thing to do.
no cap on any of those. they're literally written down as bugs. πŸ™ˆ

✨ CONTRIBUTING ✨

source code for TAP::Harness::JUnit is kept in a public Git repository. visit <https://github.com/jlavallee/tap-harness-junit>. 🌈

bug reports and feature enhancement requests are tracked at <https://rt.cpan.org/Public/Dist/Display.html?Name=TAP-Harness-JUnit>. πŸ›


copyright 2008, 2009, 2010, 2011, 2012, 2013 TAP::Harness::JUnit contributors. all rights reserved. ⭐

this program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. πŸ’œ


and that's the whole page bestie, mwah πŸ’‹ β€” this was perl v5.42.0, dated 2015-04-13, coming at you from TAP::H...::JUnit(3pm). go forth and generate that XML πŸ¦‹βœ¨

πŸ“¦ where this page comes from