S
Sean O'Dell
I'm getting a handle on the Test::Unit library, and the
automatically-running test case example was extremely simple to get
running, but now I want to switch my test cases to something
less-automatic so I can invoke the tests I want programatically.
I've seen this example:
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)
.... but it makes little sense to me in the context of the classes I have
defined (which are all derived from Test::Unit::TestCase).
If I don't require 'test/unit' then I get an error message which says
"undefined superclass `TestCase'", telling me that Test::Unit::TestCase
is defined in 'test/unit'. If I require that file, the tests all run
automatically. If I don't, I get an error message.
So ... what am I missing? I can't find any documentation on this and my
usual battery of trial-and-error attempts aren't leading me forward.
Sean O'Dell
automatically-running test case example was extremely simple to get
running, but now I want to switch my test cases to something
less-automatic so I can invoke the tests I want programatically.
I've seen this example:
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)
.... but it makes little sense to me in the context of the classes I have
defined (which are all derived from Test::Unit::TestCase).
If I don't require 'test/unit' then I get an error message which says
"undefined superclass `TestCase'", telling me that Test::Unit::TestCase
is defined in 'test/unit'. If I require that file, the tests all run
automatically. If I don't, I get an error message.
So ... what am I missing? I can't find any documentation on this and my
usual battery of trial-and-error attempts aren't leading me forward.
Sean O'Dell