Skip to content
Browse files

Add support for JUnit <skipped /> and <error />.

* Makes it use the right tag for the specific kind of failure.
* Makes the type actually match the Test::Unit class and not hardcoded to the
  parent class.
  • Loading branch information...
1 parent 131ed23 commit 6902ef5d0d844e5821a952920a5ea561fbdc9f29 @jorgenpt jorgenpt committed
Showing with 12 additions and 4 deletions.
  1. +2 −1 acceptance/verification_spec.rb
  2. +8 −1 lib/ci/reporter/test_suite.rb
  3. +2 −2 lib/ci/reporter/test_unit.rb
View
3 acceptance/verification_spec.rb
@@ -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]]>"
View
9 lib/ci/reporter/test_suite.rb
@@ -5,6 +5,8 @@
require 'delegate'
require 'stringio'
+require 'ci/reporter/test_unit'

ci_reporter version 1.6.7 is broken for everyone who is using ci_reporter with rspec instead of test_unit because of this require statement

@nicksieger ci-reporter member

Aha. Whoops. We'll get this fixed shortly.

thx :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+
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
View
4 lib/ci/reporter/test_unit.rb
@@ -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

0 comments on commit 6902ef5

Please sign in to comment.
Something went wrong with that request. Please try again.