From: Stefano Taschini Date: 2006-05-04T21:45:19+09:00 Subject: Re: Unit test setup On 02/05/06, John Wilger wrote: [...] > However, one of the rules of agile unit testing is also that the tests > must be able to run quickly (so that people will actually bother to > run them). Therefore, it is sometimes (though rarely, if you're doing > things right) helpful to make sure expensive operations happen only > when absolutely needed -- but you should only make this compromise if > you can be absolutely sure that you're not introducing state > dependencies into your tests. [...] You are absolutely right. In fact, this is exactly how it is done in rails when using transactional fixtures (which is the default setting): TestCase#setup uses the class variable @@already_loaded_fixtures to make it sure that the fixtures are loaded just once, whereas the rollback mechanism in transactional fixtures prevents the state dependencies that you mentioned. Ciao, Stefano