This runs each test in a separate ruby process. You'll never get this to work right with Test::Unit::Reporter.

On 1/30/06, Chris McMahon < [EMAIL PROTECTED]> wrote:
Interestingly, had a quick conversation with Jonathan Kohl who had run
into weirdness with test/unit and with require.  Here's what I have
now, with require replace by backticks.  It seems to be working well
so far:

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


On 1/30/06, Bret Pettichord <[EMAIL PROTECTED]> wrote:
> One problem with this is that if you have suite_foo/test_a.rb and
> suite_bar/test_a.rb, the second test won't be run. A quick fix would be to
> use "load" instead of "require".
>
> But better would be to use more of the pathname with require. Here's how i'd
> do it:
>
>   TOPDIR = File.join(File.dirname(__FILE__), '..')
>   $LOAD_PATH.unshift TOPDIR
>   tests = Dir["suite*/*.rb"]
>   tests.each {|t| require t}
>
> (I'd put the "require 'test/unit'" in the individual tests instead so that
> they could also run singly.)
>
> Bret
>
>
> On 1/30/06, Chris McMahon <[EMAIL PROTECTED]> wrote:
> >
> > Hi...
> >
> > I have some tests in directories that share common code like
> >
> > suite_foo/
> >      test_1.rb
> >      test_2.rb
> > suite_bar/
> >      test_3.rb
> >      test_4.rb
> > common/
> >      my_library.rb
> >
> > My test runner script dips into each directory and then back out:
> >
> > ##############################################
> > TOPDIR = File.join(File.dirname(__FILE__), '..')
> > $LOAD_PATH.unshift TOPDIR
> > require 'test/unit'
> >
> > test_dirs = Dir.glob("suite*")
> > test_dirs.each do |dir|
> > Dir.chdir(dir)
> >
> > test_cases = Dir.glob("*rb")
> >
> > test_cases.each {|f| require f }
> >
> > Dir.chdir("..")
> >
> > end #do
> >
> ###########################################################
> >
> > is this a reasonable approach?  It seems kinda thrashy to me, I wonder
> > if there's a better way to go about this.
> >
> > -Chris
> >
> > _______________________________________________
> > 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
>
>

_______________________________________________
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

Reply via email to