Skip Menu |

This queue is for tickets about the TAP-Harness-JUnit CPAN distribution.

Report information
The Basics
Id: 56521
Status: resolved
Priority: 0/
Queue: TAP-Harness-JUnit

People
Owner: JLAVALLEE [...] cpan.org
Requestors: TONVOON [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 0.33



Subject: Catching no_plan errors
Hi! Thanks for a great module. We have noticed that no_plan tests are listed as passes in the JUnit output. The documentation for the module says that this is because the return code is not catchable. We've found that this is possible before re-parsing the TAP output. The attached patch saves the return code from the test script before re-parsing the TAP output. I haven't tested lower versions of Test::Harness, but this definitely works with Test::Harness version 3.21. The attached patch shows how this is done Ton
Subject: TAP-Harness-JUnit_catch_bad_test_exits.patch
diff -ur TAP-Harness-JUnit-0.32.original/lib/TAP/Harness/JUnit.pm TAP-Harness-JUnit-0.32/lib/TAP/Harness/JUnit.pm --- TAP-Harness-JUnit-0.32.original/lib/TAP/Harness/JUnit.pm 2010-04-12 09:18:05.000000000 +0000 +++ TAP-Harness-JUnit-0.32/lib/TAP/Harness/JUnit.pm 2010-04-12 10:21:47.000000000 +0000 @@ -161,7 +161,8 @@ my $time = $parser->{end_time} - $parser->{start_time}; $time = 0 if $self->{__notimes}; - my $badretval; + # Get the return code of test script before re-parsing the TAP output + my $badretval = $parser->exit; if ($self->{__namemangle}) { # Older version of hudson crafted an URL of the test @@ -210,8 +211,8 @@ # Comments if ($result->type eq 'comment') { - # See BUGS - $badretval = $result if $result->comment =~ /Looks like your test died/; + # See BUGS - I think this whole bit can be removed - Ton Voon + #$badretval = $result if $result->comment =~ /Looks like your test died/; #$comment .= $result->comment."\n"; # ->comment has leading whitespace stripped @@ -293,7 +294,8 @@ } # Bad return value. See BUGS - elsif ($badretval and not $xml->{errors}) { + #elsif ($badretval and not $xml->{errors}) { + elsif ($badretval) { # Fake a failed test push @{$xml->{testcase}}, { 'time' => 0, @@ -301,11 +303,12 @@ classname => $name, failure => { type => 'Died', - message => $badretval->comment, - content => $badretval->raw, + message => "Test died with return code $badretval", + content => "Test died with return code $badretval", }, }; $xml->{errors}++; + $xml->{tests}++; } # Make up times for sub-tests