On Thu, Jul 17, 2003 at 06:05:26AM +0900, Chris Morris wrote: > I browsed the previous thread about this topic -- I'm in favor of > Test::Unit determining that a TestCase class has empty tests and calling > that a failure -- but in some cases I have superclasses with shared > fixture code and intentionally no test methods of their own, yet > Test::Unit still complains about these: > > C:\Temp>more whack.rb > require 'test/unit' > > class MyBaseFixture < Test::Unit::TestCase > def setup > puts 'setup' > end > end > > class MyTestCase < MyBaseFixture > def test_me > assert(1 == 1) > end > end ... > I know I could redesign my stuff to not use inheritence here, but I'd > prefer to only see a failure raised if I have an empty test: Another option would be to use inheritence via a module mixin rather than a concrete superclass: require 'test/unit' module MyBaseFixture def setup puts 'setup' end end class MyTestCase < Test::Unit::TestCase include MyBaseFixture def test_me assert(1 == 1) end end Produces: $ ruby x.rb Loaded suite x Started setup . Finished in 0.095004 seconds. 1 tests, 1 assertions, 0 failures, 0 errors Otherwise you can just define a null test in your superclass: def test_dummy; end which seems to keep it happy. I don't really see why "no tests" is considered a failure though. I would equate "no failures" with "success". I don't think an empty test (i.e. one which makes no assertions) should be considered an error though. It would be quite legitimate to have a method which performs no tests under certain circumstances dependent on external criteria: def test_foo if @foo_is_relevant ... do some tests end end If that were outlawed, then you would have to jump through hoops to get that result, e.g. by putting test_foo in a separate module and conditionally including that module. Regards, Brian.