Robert Feldt <feldt / ce.chalmers.se> writes:

> On Fri, 25 Aug 2000, Robert Feldt wrote:
> 
> > I have a Test_MyClass < RUNIT::TestCase class that tests my class MyClass.
> > I want to run the tests for different parameters to MyClass. How do this
> > nicely?

How about subclassing Test_MyClass using something like:

   class Test_MyClass
      #
      # hundreds of wonderful tests...
      # using the instance variable @myClass
   end

   class Test_MyClass_Alg1 < Test_MyClass
      def setup
         @myClass = MyClass.new(MyClass::ALG1)
      end
   end

   class Test_MyClass_Alg2 < Test_MyClass
      def setup
         @myClass = MyClass.new(MyClass::ALG2)
      end
   end

   class Test_MyClass_Alg3 < Test_MyClass
      def setup
         @myClass = MyClass.new(MyClass::ALG3)
      end
   end


That way the tests remain the same, and all you change is the setup.


Regards


Dave