Test::Unit::Reporter help?

C

Chris McMahon

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
 
A

Alexey Verkhovsky

Chris said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,983
Messages
2,570,187
Members
46,747
Latest member
jojoBizaroo

Latest Threads

Top