views:

31

answers:

1

Hi,

I have a test suite with me. I want to add another test class with a set of tests in the test suite. Since this is a class with test cases, I do not know how to add it to the test suite.

testsuite - existing test suite.
FactorTest.rb - test class with test methods (class name is FactorTest)

I tried
testsuite<<FactorTest
and then
Test::Unit::UI::Console::TestRunner.run(testuite)

but it fails:

/ruby/1.8/test/unit/testsuite.rb:54:in `size': undefined method `size' for
FactorTest:Class (NoMethodError) 

Please could someone help?

A: 

From the docs at http://www.ensta.fr/~diam/ruby/online/ruby-doc-stdlib/libdoc/test/unit/rdoc/classes/Test/Unit.html

 require 'test/unit/testsuite'
 require 'tc_myfirsttests'
 require 'tc_moretestsbyme'
 require 'ts_anothersetoftests'

 class TS_MyTests
   def self.suite
     suite = Test::Unit::TestSuite.new
     suite << TC_MyFirstTests.suite
     suite << TC_MoreTestsByMe.suite
     suite << TS_AnotherSetOfTests.suite
     return suite
   end
 end
 Test::Unit::UI::Console::TestRunner.run(TS_MyTests)
Gishu