This is convenient when getting started, but causes bafflement when people want to do anything complex.
This is all done by Test::Unit::AutoRunner. In your case, you need to take a look at this (in test/unit/autorunner.rb) and call it with some non-default arguments.
Your immediate problem is that Test::Unit::Reporter wants a bunch of test cases and instead you are giving it a bunch of files. Test cases are objects (that are created in these files).
Here is some additional doc from Test::Unit that explains what is going on.
http://www.ruby-doc.org/stdlib/libdoc/test/unit/rdoc/classes/Test/Unit.html
Anyone complaining about wierdness with 'test/unit' and require needs to read this!
Bret
On 1/30/06, Chris McMahon <
[EMAIL PROTECTED]> wrote:
Hi again...
I'm trying to integrate Test::Unit::Reporter with my little harness
script below, and struggling.
Ideally, I would pass each "test_cases" array to Reporter and it would
Do The Right Thing, but that's not happening.
##############################
#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
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general
_______________________________________________ Wtr-general mailing list [email protected] http://rubyforge.org/mailman/listinfo/wtr-general
