From: Mat Schaffer Date: 2007-02-28T12:54:52+09:00 Subject: Re: Test::Unit and one-time setup and teardown On Feb 27, 2007, at 3:25 PM, Ara Vartanian wrote: > Does anyone know of a way of performing one-time setup and teardown > per Test::Unit::TestCase? > > I have an integration test with an external component where, > unfortunately, mocking out a server response is not feasible. So I > need to mount a servlet to interact with my test. It would be > pointless and slow to do this once for every test method. I know > other unit testing frameworks define such callbacks. Does > Test::Unit? If not, is there a clever way of getting around it? > > I am using Rails's 'test/helper', so I'm not instantiating my own > test harness. Obviously, I can setup any needed resources in the > class scope of the unit test itself, BUT that still doesn't give me > a callback for teardown. > > Any ideas? Have you tried BEGIN {} and END {}? But perhaps there's something more graceful. -Mat