On 2/26/07, Michael Schuerig <michael / schuerig.de> wrote:
>
> For a performance test I need to populate the database with a large
> number of records. The individual test cases only read the database
> contents. It is rather time consuming and, after all, unnecessary to do
> a full setup and teardown for each test case. I'd much prefer a clean
> way to do setup and teardown once for the entire TestCase subclass.
> AFAIR, in JUnit, there is a decorator for just this purpose. Is there
> something similar for Test::Unit?
>
> Michael
>
> --
> Michael Schuerig
> mailto:michael / schuerig.de
> http://www.schuerig.de/michael/
>
>
I always use constants for that kind of problems.
For what you hide behind the constants is of course a matter of taste
sometimes I do something like the following, but that is just like me.

class << DatabaseProxy = Class.new
   <init code>
    def whatever...
    end
    def play_it_again_sam
    end
    def etcetc
end

class X < Test::Unit::TestCase

   def testxxx...
         DatabaseProxy.whatever

...
end

HTH
Robert
-- 
We have not succeeded in answering all of our questions.
In fact, in some ways, we are more confused than ever.
But we feel we are confused on a higher level and about more important things.
-Anonymous