CI_reporter throws undefined method Test::Unit::Omission #51

Closed
PiotrNestor opened this Issue Feb 9, 2012 · 2 comments

Comments

Projects
None yet
2 participants

Environment: Ruby 1.9.3-p0, test-unit 2.4.5

When 'omit' is used the CI_reporter fails:
./usr/local/rvm/gems/ruby-1.9.3-p0/gems/ci_reporter-1.7.0/lib/ci/reporter/test_unit.rb:29:in name': undefined methodexception' for #Test::Unit::Omission:0x8f8660c (NoMethodError)
from /usr/local/rvm/gems/ruby-1.9.3-p0/gems/ci_reporter-1.7.0/lib/ci/reporter/test_suite.rb:146:in block (2 levels) in to_xml' from /usr/local/rvm/gems/ruby-1.9.3-p0/gems/ci_reporter-1.7.0/lib/ci/reporter/test_suite.rb:140:ineach'
from /usr/local/rvm/gems/ruby-1.9.3-p0/gems/ci_reporter-1.7.0/lib/ci/reporter/test_suite.rb:140:in `block in to_xml'

The test example:
require 'rubygems'
gem 'test-unit'
require 'test/unit'
require "ci/reporter/rake/test_unit_loader"

class TC_MyTests < Test::Unit::TestCase
def test_01_login
puts "Logged in"
end

def test_02_omit
puts "Hello 1"
omit()
puts "Hello 2"
end

def test_03_logoff
puts "Logged off"
end
end

Owner

nicksieger commented Feb 10, 2012

Thanks for the example. Hopefully there's an easy fix to this, because the code is supposed to handle omissions already.

I think the error is in the CI::Reporter::Failure class

The fix is to use a the symbols :Omission, :Notification when testing the contents of Test::Unit.constants array

class Failure
  def self.new(fault)
    return TestUnitFailure.new(fault) if fault.kind_of?(Test::Unit::Failure)
    return TestUnitSkipped.new(fault) if Test::Unit.constants.include?(:Omission) ....
    return TestUnitNotification.new(fault) if Test::Unit.constants.include?(:Notification) ....
    TestUnitError.new(fault)
  end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment