Forum: Ruby Test::Unit::Reporter help?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Chris McMahon (Guest)
on 2006-02-02 00:25
(Received via mailing list)
Crossposted to the Watir list, my apologies:

I'm trying to integrate Test::Unit::Reporter with my little harness
script below, and struggling.  I think I must have a basic
misunderstanding.

Ideally, I would pass each "test_cases" array to Reporter and it would
Do The Right Thing, but that's not happening.

Immediate error is "...uninitialized constant
Test::Unit::UI::Reporter::Reporter (NameError)"

##############################
#ORIGINAL WORKING SCRIPT

TOPDIR = File.join(File.dirname(__FILE__), '..')
$LOAD_PATH.unshift TOPDIR
require 'test/unit'
require 'fileutils'
include FileUtils::Verbose

test_dirs = Dir.glob("suite**")

0.upto(test_dirs.length - 1)  do |dirnum|

chdir(test_dirs[dirnum])
puts ""
puts "working in #{test_dirs[dirnum]}"

test_cases = Dir.glob("*rb")

test_cases.each do |casex|
puts "running #{casex}"

test_result = `ruby #{casex}`
puts test_result
end

chdir("..")

end #do
#########################################
# WHAT I WISH WOULD HAPPEN

TOPDIR = File.join(File.dirname(__FILE__), '..')
$LOAD_PATH.unshift TOPDIR
require 'test/unit'
require 'fileutils'
include FileUtils::Verbose

   require 'test/unit/testsuite'
   require 'test/unit/ui/reporter/reporter'
   @test_cases = Test::Unit::TestSuite.new
   FileUtils.mkdir_p 'build/report'

test_dirs = Dir.glob("suite*")

0.upto(test_dirs.length - 1)  do |dirnum|

chdir(test_dirs[dirnum])
puts ""
puts "working in #{test_dirs[dirnum]}"

@test_cases = Dir.glob("*rb")

      Test::Unit::UI::Reporter::Reporter.run(@test_cases,
'build/report', :xml)

chdir("..")

end #do
Alexey V. (Guest)
on 2006-02-02 09:12
(Received via mailing list)
Chris McMahon wrote:

>      Test::Unit::UI::Reporter::Reporter.run(@test_cases, 'build/report', :xml)
>
>
Replace this with

      Test::Unit::UI::Reporter.run(@test_cases, 'build/report', :xml)


and it might work. At the very least, you'll be getting some other
error! :)

Alex
This topic is locked and can not be replied to.