coma_killen / fastmail.fm wrote: > Whats the standard way to reuse the Test::Unit tests for a > base class when deriving a subclass? Should the testcase > class derive from the base class testcase class or are there > better ways? The best way I have found is to inherit, then create the testee in a method called 'warmUp'. Then override that method. Don't call 'warmUp' from 'initialize'. This page does not contain enough: http://c2.com/cgi/wiki?AbstractTest Test rigs are pragmatic, not magic. Put another way, Liskov Substitution Principle applies between the base and derived test, so the system should >not< be able to tell the difference between a test method that calls 'warmUp' and one that does not. LSP in the tests does not mean everyone must call 'warmUp'. Classes, however, should follow LSP, so tests a base class should pass the derived class should pass too. Put them together, and some test methods should not call 'warmUp'. Pragmatically, they test support aspects of the tested class. LSP does not apply. So the complete answer: Inherit, but don't override 'initialize'. Override, instead, 'warmUp', and call this at the top of each method. In the base test class, 'warmUp' returns a base class instance, and in a derived class it returns a derived class instance. 'warmUp' should assign the testee to a member variable (for convenience), and the 'tearDown' method may care to destroy or un-do this testee. (This happens to be Robert C. Martin's "Stairway to Heaven Design Pattern", but with different LSP ramifications.) -- Phlip http://www.greencheese.org/PerfideousDelinquency -- Set phasers on illin' --