Hi, I'm trying to manully run unit test using Test::Unit because I need
to isolate certain requires from others in the
course of the tests. Certain files I'm testing can potentially cause
conflits with others, so I need to run them in isolation. But I still
want to tally the tests/assertions/errors, etc. So I'm wondering if I'm
doing this right. Specifically, is popen("-", "w+") giving me a whole
seperate "require space" to utilize?
Here's my code so far:
def fork_test( testfile )
result = nil
IO.popen("-","w+") do |pipe|
result = pipe.instance_eval do
require 'test/unit'
require 'test/unit/collector'
require 'test/unit/collector/objectspace'
require 'test/unit/ui/testrunnermediator'
load( testfile )
tests = Test::Unit::Collector::ObjectSpace.new.collect
runner = Test::Unit::UI::TestRunnerMediator.new( tests )
runner.run_suite
end
end
p result
result
end
Hi, I'm trying to manully run unit test using Test::Unit because I need
to isolate certain requires from others in the
course of the tests. Certain files I'm testing can potentially cause
conflits with others, so I need to run them in isolation. But I still
want to tally the tests/assertions/errors, etc. So I'm wondering if I'm
doing this right. Specifically, is popen("-", "w+") giving me a whole
seperate "require space" to utilize?
Here's my code so far:
def fork_test( testfile )
result = nil
IO.popen("-","w+") do |pipe|
result = pipe.instance_eval do
require 'test/unit'
require 'test/unit/collector'
require 'test/unit/collector/objectspace'
require 'test/unit/ui/testrunnermediator'
load( testfile )
tests = Test::Unit::Collector::ObjectSpace.new.collect
runner = Test::Unit::UI::TestRunnerMediator.new( tests )
runner.run_suite
end
end
p result
result
end
Thanks,
T.
#
# via child
#
stdout =
IO::popen('-', 'r+') do |child|
if child
child.puts src
child.close_write
child.read
else
eval STDIN.read
end
end
puts "child - stdout <#{ stdout.strip }>"
#
# via ruby
#
stdout =
IO::popen('ruby', 'r+') do |ruby|
ruby.puts src
ruby.close_write
ruby.read
end
puts "ruby - stdout <#{ stdout.strip }>"
email :: ara [dot] t [dot] howard [at] noaa [dot] gov
phone :: 303.497.6469
Your life dwells amoung the causes of death Like a lamp standing in a strong breeze. --Nagarjuna