|
From: Dean H. <de...@xs...> - 2005-03-20 16:11:59
|
yup, finally got to looking at it...just a matter of moving setup method into the try block. cool, should be a bit nicer. dean ----- Original Message ----- From: "Barrie Treloar" <bae...@gm...> To: "Dean Hiller" <de...@xs...> Cc: <jun...@li...> Sent: Sunday, March 20, 2005 1:23 AM Subject: Re: [Junit-devel] Why is tearDown() not called when there are exceptions in setUp()? > It was an easy fix. > I've submitted patch id 1166866. > > > On Sat, 19 Mar 2005 16:31:28 +1030, Barrie Treloar <bae...@gm...> > wrote: >> Do you have code for this, or should I grab the cvs and submit a patch >> myself? >> >> >> On Fri, 18 Mar 2005 07:53:07 -0700, Dean Hiller <de...@xs...> >> wrote: >> > may be a bug. I remember some code I submitted a while back to JUnit >> > was >> > committed with a bug, and I sent a message that it needed to be fixed >> > but >> > don't know if it was. >> > >> > Basically, JUnit is now supposed to run setup and if there is an >> > exception >> > save it, run teardown and if there is another exception, discard it and >> > throw the one from setup. Same for test cases. This is because alot >> > of the >> > time, an exception in teardown can be due to an exception in the test >> > case >> > or the setup that happened first and if the first one is fixed, the >> > teardown >> > will be fixed to. >> > thanks, >> > dean >> > >> > ----- Original Message ----- >> > From: "Barrie Treloar" <bae...@gm...> >> > To: <jun...@li...> >> > Sent: Thursday, March 17, 2005 8:46 PM >> > Subject: [Junit-devel] Why is tearDown() not called when there are >> > exceptions in setUp()? >> > >> > >I notice the unit test in >> > > junit.tests.framework.TestCaseTest.testTearDownSetupFails() >> > > specifically is written to show that an Exception in setUp() does not >> > > call tearDown(). >> > > >> > > Is there a reason for this? >> > > I've tried searching on the net for the reason behind it by have come >> > > up >> > > blank. >> > > >> > > When I place setup code inside the test and an Exception occurs the >> > > tearDown() method will be called. >> > > >> > > However, if I then move this to be common across all test fixtures by >> > > placing it inside setUp() then the test behaves differently because >> > > now tearDown() is not called. >> > > >> > > Can anyone provide any insights into this please? >> > > >> > > Thanks >> > > Bae >> > > >> > > >> > > ------------------------------------------------------- >> > > SF email is sponsored by - The IT Product Guide >> > > Read honest & candid reviews on hundreds of IT Products from real >> > > users. >> > > Discover which products truly live up to the hype. Start reading now. >> > > http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click >> > > _______________________________________________ >> > > Junit-devel mailing list >> > > Jun...@li... >> > > https://lists.sourceforge.net/lists/listinfo/junit-devel >> > >> > ------------------------------------------------------- >> > SF email is sponsored by - The IT Product Guide >> > Read honest & candid reviews on hundreds of IT Products from real >> > users. >> > Discover which products truly live up to the hype. Start reading now. >> > http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click >> > _______________________________________________ >> > Junit-devel mailing list >> > Jun...@li... >> > https://lists.sourceforge.net/lists/listinfo/junit-devel >> > >> > > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real users. > Discover which products truly live up to the hype. Start reading now. > http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click > _______________________________________________ > Junit-devel mailing list > Jun...@li... > https://lists.sourceforge.net/lists/listinfo/junit-devel |