Subject: | xmlfile is manditory, which prevents use of this module as a drop-in replacement for TAP::Harness |
TAP::Harness->new does not require and xmlfile parameter, but
TAP::Harness::JUnit->new requires it. This makes it impossible to use
TAP::Harness::JUnit as a drop-in replacement for TAP::Harness. This
functionality is necessary, for example, if one would like to use
TAP::Harness::JUnit as the harness used by prove. The supplied patch
defaults the xmlfile argument to "junit_output.xml" if the use does not
supply it, and issues a warning. A test for this behavior has been
added. See example using prove below:
user@host $ prove sometest.t
sometest....ok
All tests successful.
Files=1, Tests=1, 1 wallclock secs ( 0.03 usr 0.01 sys + 0.02 cusr
0.00 csys = 0.06 CPU)
Result: PASS
user@host $ prove --harness=TAP::Harness::JUnit sometest.t
'xmlfile' argument is mandatory at
/usr/local/lib/perl5/5.8.5/App/Prove.pm line 485
user@host $ cd TAP-Harness-JUnit-0.26/; perl Build.PL; sudo ./Build
install; cd -
Checking whether your kit is complete...
Looks good
Checking prerequisites...
Looks good
Deleting Build
Removed previous script 'Build'
Creating new 'Build' script for 'TAP-Harness-JUnit' version '0.26'
Installing /usr/local/lib/perl5/site_perl/5.8.5/TAP/Harness/JUnit.pm
Skipping /usr/local/share/man/man3/TAP::Harness::JUnit.3 (unchanged)
Writing
/usr/local/lib/perl5/site_perl/5.8.5/i686-linux/auto/TAP/Harness/JUnit/.packlist
user@host $ prove --harness=TAP::Harness::JUnit sometest.t
xmlfile argument not supplied, defaulting to "junit_output.xml" at
/usr/local/lib/perl5/site_perl/5.8.5/TAP/Harness/JUnit.pm line 63.
You should consider using "merge" parameter. See BUGS section of
TAP::Harness::JUnit manual at
/usr/local/lib/perl5/site_perl/5.8.5/TAP/Harness/JUnit.pm line 65.
sometest....ok
All tests successful.
Files=1, Tests=1, 0 wallclock secs ( 0.01 usr 0.00 sys + 0.02 cusr
0.00 csys = 0.03 CPU)
Result: PASS
user@host $ cat junit_output.xml
<?xml version='1.0' encoding='utf-8'?>
<testsuites>
<testsuite name="sometest_t" errors="0" failures="0" tests="1" time="0">
<system-out>1..1
ok 1
</system-out>
<testcase name="Unnamed test case 1" classname="sometest_t" time="0" />
</testsuite>
</testsuites>
user@host $
Subject: | TAP-Harness-JUnit.patch |
diff -ruN TAP-Harness-JUnit-0.25/Build.PL TAP-Harness-JUnit-0.26/Build.PL
--- TAP-Harness-JUnit-0.25/Build.PL 2008-11-27 01:43:52.000000000 -0800
+++ TAP-Harness-JUnit-0.26/Build.PL 2008-12-31 09:49:15.000000000 -0800
@@ -7,7 +7,7 @@
module_name => 'TAP::Harness::JUnit',
license => 'perl',
dist_author => 'Lubomir Rintel (Good Data) <lubo.rintel@gooddata.com>',
- dist_version => '0.25',
+ dist_version => '0.26',
requires => {
'TAP::Harness' => 3.05,
'File::Temp' => 0,
diff -ruN TAP-Harness-JUnit-0.25/lib/TAP/Harness/JUnit.pm TAP-Harness-JUnit-0.26/lib/TAP/Harness/JUnit.pm
--- TAP-Harness-JUnit-0.25/lib/TAP/Harness/JUnit.pm 2008-11-27 01:43:52.000000000 -0800
+++ TAP-Harness-JUnit-0.26/lib/TAP/Harness/JUnit.pm 2008-12-31 09:48:51.000000000 -0800
@@ -36,7 +36,7 @@
use Scalar::Util qw/blessed/;
use Encode;
-our $VERSION = '0.25';
+our $VERSION = '0.26';
=head2 new
@@ -57,9 +57,11 @@
$args ||= {};
# Process arguments
- my $xmlfile = $args->{xmlfile} or
- $class->_croak("'xmlfile' argument is mandatory");
-
+ my $xmlfile;
+ unless( $xmlfile = $args->{xmlfile} ){
+ $xmlfile = 'junit_output.xml';
+ warn 'xmlfile argument not supplied, defaulting to "junit_output.xml"';
+ }
defined $args->{merge} or
warn 'You should consider using "merge" parameter. See BUGS section of TAP::Harness::JUnit manual';
diff -ruN TAP-Harness-JUnit-0.25/t/xmlfile_default.t TAP-Harness-JUnit-0.26/t/xmlfile_default.t
--- TAP-Harness-JUnit-0.25/t/xmlfile_default.t 1969-12-31 16:00:00.000000000 -0800
+++ TAP-Harness-JUnit-0.26/t/xmlfile_default.t 2008-12-31 09:47:36.000000000 -0800
@@ -0,0 +1,15 @@
+#!/usr/bin/perl
+
+use strict; use warnings;
+
+use TAP::Harness::JUnit;
+use Test::More;
+
+plan tests => 3;
+
+my $harness;
+eval { $harness = TAP::Harness::JUnit->new };
+
+ok( !$@ );
+ok( $harness );
+isa_ok( $harness, 'TAP::Harness::JUnit');