Peter Hickman
8/29/2008 2:47:00 PM
Ron Fox wrote:
> Peter Hickman wrote:
>> I am putting some tests together that need to access an external
>> service which I can use setup() and teardown() to control. The
>> problem is that these methods are run before and after each test,
>> this slows things down quite a bit. Ideally there would be one setup
>> before all the tests are run and one teardown at the end. Nunit has
>> this functionality and I'm sure I've seen it in other frameworks.
>>
>> Is there a way to get until test to do this or will I have to end up
>> putting all my tests in a single test method?
>>
>>
> Prior to all test executions.. you could put the setup at the outer
> level of the script file.
>
Putting the global setup code outside the class does work but there is
no way to get the global teardown to work. Even putting it in an END
block (a horrible Perlism) doesn't work.
Then you come to test suites, which results in all the global startup
code being run before any of the tests.
I think I will have to look into the code for unit test, how hard can it
be?