test-unit/lib/test/unit.rb in groonga-0.0.7 vs test-unit/lib/test/unit.rb in groonga-0.9.0
- old
+ new
@@ -177,11 +177,11 @@
# A really simple test might look like this (#setup and #teardown are
# commented out to indicate that they are completely optional):
#
# require 'test/unit'
#
- # class TC_MyTest < Test::Unit::TestCase
+ # class MyTest < Test::Unit::TestCase
# # def setup
# # end
#
# # def teardown
# # end
@@ -192,63 +192,43 @@
# end
#
#
# == Test Runners
#
- # So, now you have this great test class, but you still need a way to
- # run it and view any failures that occur during the run. This is
- # where Test::Unit::UI::Console::TestRunner (and others, such as
- # Test::Unit::UI::GTK::TestRunner) comes into play. The console test
- # runner is automatically invoked for you if you require 'test/unit'
- # and simply run the file. To use another runner, or to manually
- # invoke a runner, simply call its run class method and pass in an
- # object that responds to the suite message with a
- # Test::Unit::TestSuite. This can be as simple as passing in your
- # TestCase class (which has a class suite method). It might look
- # something like this:
+ # So, now you have this great test class, but you still
+ # need a way to run it and view any failures that occur
+ # during the run. There are some test runner; console test
+ # runner, GTK+ test runner and so on. The console test
+ # runner is automatically invoked for you if you require
+ # 'test/unit' and simply run the file. To use another
+ # runner simply set default test runner ID to
+ # Test::Unit::AutoRunner:
#
- # require 'test/unit/ui/console/testrunner'
- # Test::Unit::UI::Console::TestRunner.run(TC_MyTest)
+ # require 'test/unit'
+ # Test::Unit::AutoRunner.default_runner = "gtk2"
#
- #
# == Test Suite
#
# As more and more unit tests accumulate for a given project, it
# becomes a real drag running them one at a time, and it also
# introduces the potential to overlook a failing test because you
# forget to run it. Suddenly it becomes very handy that the
# TestRunners can take any object that returns a Test::Unit::TestSuite
# in response to a suite method. The TestSuite can, in turn, contain
# other TestSuites or individual tests (typically created by a
# TestCase). In other words, you can easily wrap up a group of
- # TestCases and TestSuites like this:
+ # TestCases and TestSuites.
#
- # require 'test/unit/testsuite'
- # require 'tc_myfirsttests'
- # require 'tc_moretestsbyme'
- # require 'ts_anothersetoftests'
+ # Test::Unit does a little bit more for you, by wrapping
+ # these up automatically when you require
+ # 'test/unit'. What does this mean? It means you could
+ # write the above test case like this instead:
#
- # 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)
- #
- # Now, this is a bit cumbersome, so Test::Unit does a little bit more
- # for you, by wrapping these up automatically when you require
- # 'test/unit'. What does this mean? It means you could write the above
- # test case like this instead:
- #
# require 'test/unit'
- # require 'tc_myfirsttests'
- # require 'tc_moretestsbyme'
- # require 'ts_anothersetoftests'
+ # require 'test_myfirsttests'
+ # require 'test_moretestsbyme'
+ # require 'test_anothersetoftests'
#
# Test::Unit is smart enough to find all the test cases existing in
# the ObjectSpace and wrap them up into a suite for you. It then runs
# the dynamic suite using the console TestRunner.
#
@@ -321,15 +301,16 @@
# practitioners about typos, grammatical errors, unclear statements,
# missing points, etc., in this document (or any other).
#
module Unit
- # If set to false Test::Unit will not automatically run at exit.
+ # Set true when Test::Unit has run. If set to true Test::Unit
+ # will not automatically run at exit.
def self.run=(flag)
@run = flag
end
- # Automatically run tests at exit?
+ # Already tests have run?
def self.run?
@run ||= false
end
end
end