> -----Original Message-----
> From: Barbara Allori [mailto:[EMAIL PROTECTED]
> Sent: lundi 14 f�vrier 2005 17:08
> To: Cactus Users List
> Subject: Re: Test execution
> 

[snip]

> Viewing the code it's clear that the tearDown() executes only if the
> setUp() (outside the try) executes without errors. In your opinion is
> this a JUnit error or is intentional?

I'd say intentional ;-) That said, I can't think of why it wouldn't work if
setUp was inside the try/catch. Of course there could be cases where the
fixture is not yet defined so cleaning it would lead to errors. But I can
also see cases (the one that you must have in mind) where the cleaning would
not be affected and where it would be useful to have this cleaning happen.

All that said, I personally used tearDown() very seldom. Why? Because you
can never be sure the teardown() will be executed before the next test is
run. Imagine that the tearDown cleans something in the database and that you
abort your test with ctrl-c. Chance is that if you run some tests it'll now
fail because the database is not in the right state. I much prefer to ensure
the right state is defined in setUp(). That's probably why I've never found
this to be a problem (the fact that setUp is not in the try/catch).

You may want to ask on the junit mailing list if you wish to have some other
opinion.

Thanks
-Vincent




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to