I needed to run multiple tests in the same directory quite
often. I name the test classes like

  class TestMyClass < RUNIT::TestCase

and the files incorporating test classes like
test_myclass.rb. Additionally I like to get only one report how 
the tests went.

Here's a small alltest.rb script which goes on searching automatically all
the properly named files, requires them, gathers the test classes builds a
one single suite out of them and finally runs it.

Maybe something like this should be included to the standard RubyUnit
package.

      - Aleksi

 
#!/usr/local/bin/ruby

# (C) 2001 Aleksi Niemela
# A generic test runner.  

# It scans for all files starting with "test_" and requires them.
# Then it finds all the test classes, and their test methods
# and builds a one single suite out of them, which is finally run.

# require all files containing tests
Dir["*"].grep(/^test_.+?\.rb$/).sort.each do |fname|
  require fname
end

# find test classes (which are always derived from RUNIT::TestCase)
testCases = []
ObjectSpace.each_object(Class) do |klass|
  testCases << klass if klass.ancestors[1..-1].include? RUNIT::TestCase
end

# finally build a suite containing all tests
suite = RUNIT::TestSuite.new
testCases.sort { |a,b| a.name <=> b.name }.each do |klass|
  klass.instance_methods(true).grep(/^test/).sort.each do |m|
    suite.add_test(klass.new(m, klass.name))
  end
end

# and run it
RUNIT::CUI::TestRunner.run(suite)