On Tue, Feb 27, 2007 at 03:02:06AM +0900, Michael Schuerig 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. 

Options I can think of:

1. Use a class variable - or even a global variable - to record when the
setup has been done, so it only gets done once.

2. Write all your tests which depend on this database as a single test. You
can always call out to other methods if you like.

  def test_everything
    init_database
    do_1
    do_2
    ... etc
  end