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
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