Support <skipped /> and <error /> in JUnit output. #46

Merged
merged 2 commits into from Dec 13, 2011
Jump to file or symbol
Failed to load files and symbols.
+13 −5
Split
@@ -17,7 +17,8 @@
doc.root.attributes["assertions"].should == "1"
doc.root.attributes["tests"].should == "1"
doc.root.elements.to_a("/testsuite/testcase").size.should == 1
- doc.root.elements.to_a("/testsuite/testcase/failure").size.should == 2
+ doc.root.elements.to_a("/testsuite/testcase/error").size.should == 1
+ doc.root.elements.to_a("/testsuite/testcase/failure").size.should == 1
doc.root.elements.to_a("/testsuite/system-out").first.texts.inject("") do |c,e|
c << e.value; c
end.strip.should == "Some <![CDATA[on stdout]]>"
@@ -5,6 +5,8 @@
require 'delegate'
require 'stringio'
+require 'ci/reporter/test_unit'
+
module CI
module Reporter
# Emulates/delegates IO to $stdout or $stderr in order to capture output to report in the XML file.
@@ -138,7 +140,12 @@ def to_xml(builder)
builder.skipped
else
failures.each do |failure|
- builder.failure(:type => builder.trunc!(failure.name), :message => builder.trunc!(failure.message)) do
+ tag = case failure
+ when TestUnitSkipped then :skipped
+ when TestUnitError then :error
+ else :failure end
+
+ builder.tag!(tag, :type => builder.trunc!(failure.name), :message => builder.trunc!(failure.message)) do
builder.text!(failure.message + " (#{failure.name})\n")
builder.text!(failure.location)
end
@@ -44,7 +44,7 @@ class TestUnitSkipped
def initialize(fault) @fault = fault end
def failure?() false end
def error?() false end
- def name() Test::Unit::Omission.name end
+ def name() @fault.class.name end
def message() @fault.message end
def location() @fault.location.join("\n") end
end
@@ -54,7 +54,7 @@ class TestUnitNotification
def initialize(fault) @fault = fault end
def failure?() false end
def error?() false end
- def name() Test::Unit::Notification.name end
+ def name() @fault.class.name end
def message() @fault.message end
def location() @fault.location.join("\n") end
end
@@ -1,5 +1,5 @@
module CI
module Reporter
- VERSION = "1.6.6"
+ VERSION = "1.6.7"
end
end