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

πŸ“¦
version 0.17 Β· 5 versions
, in debian trixie, ubuntu resolute, ubuntu stonking

πŸ’– TAP::F...::JUnit β€” the manual, but make it cute πŸ’–

okay bestie, welcome to TAP::F...::JUnit(3pm) β€” yes the title is abbreviated like that in the header, it's giving ✨mystery✨ β€” and this is a User Contributed Perl Documentation page, so you know it's community-made with love. sit down, grab a strawberry πŸ“, and let's get into it.


✨ NAME ✨

TAP::Formatter::JUnit β€” the harness output delegate that makes JUnit output. it's the friend who translates your TAP vibes into JUnit XML, no cap πŸ’…


✨ 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);

like. look at that. she's gorgeous. πŸŽ€


✨ DESCRIPTION ✨

real talk: this code is currently in alpha state and is subject to change. so don't build your whole personality on it, ok? 🫢

TAP::Formatter::JUnit provides JUnit output formatting for TAP::Harness. that's the whole gig. iconic.

by default β€” like, when you run it with prove β€” the entire test suite gets gathered together into a single JUnit XML document, which then gets displayed on STDOUT. one big beautiful doc. ✨

BUT. you can also have individual JUnit XML files dumped for each individual test, by setting PERL_TEST_HARNESS_DUMP_TAP to a directory you want the JUnit XML dumped to. heads up though: doing that will also cause TAP::Harness to dump the original TAP output into that directory too. and honestly? IMHO that's ok, because now you've got the data in two parseable formats. slay. two formats, zero regrets. πŸ’…

timing information is included in the JUnit XML β€” but only if you specified --timer when you ran prove. no timer flag, no timing tea. ⏱️

in standard use, a passing TODO is treated as a failure condition (and it's reported as such in the generated JUnit). if you want those to be treated as a pass and not a fail condition instead, setting ALLOW_PASSING_TODOS in your environment will turn these into pass conditions. your call, bestie. 🌸

and the JUnit output generated is partial to being grokked by Hudson (http://hudson.dev.java.net/). that's the build tool the author was using at the moment and needed to be able to generate JUnit output for. so. yeah. that's the lore. πŸ“œ


✨ ATTRIBUTES ✨

  • testsuites β€” list-ref of test suites that have been executed. the receipts. the whole roster. πŸ‘‘
  • xml β€” an XML::Generator instance, to be used to generate XML output. she's the machine that makes the XML. 🧚

✨ METHODS ✨

  • open_test($test, $parser) β€” an over-ridden open_test() method. it creates a TAP::Formatter::JUnit::Session session instead of a console formatter session. different session, different vibe. πŸ¦‹
  • summary() β€” prints the summary report (in JUnit) after all tests are run. the final word. the closing number. periodt. πŸ’–
  • add_testsuite($suite) β€” adds the given XML test $suite to the list of test suites that we've executed and need to summarize. adding to the pile, respectfully. ⭐

✨ AUTHOR ✨

Graham TerMarsch <cpan@howlingfrog.com> β€” absolute legend, wrote the whole thing. πŸ‘‘

many thanks to Andy Armstrong and all those involved for the fabulous set of tests in Test::Harness; they became the basis for the unit tests here. genuinely iconic contribution, fr fr.

other thanks go out to those that have provided feedback, comments, or patches:

Mark Aufflick
Joe McMahon
Michael Nachbaur
Marc Abramowitz
Colin Robertson
Phillip Kimmey
Dave Lambley

shoutout to the whole squad. y'all ate. 🍽️✨


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. free as in freedom, bestie. 🌈


✨ SEE ALSO ✨


okay that's the whole page, you made it to the end 🫢 this beauty was rendered by perl v5.40.0 and dated 2025-02-07, and yeah it's the User Contributed Perl Documentation edition. go forth and format your JUnit, main character. πŸ’…βœ¨πŸŽ€

πŸ“¦ where this page comes from