You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by Mamta Satoor <ms...@gmail.com> on 2013/09/11 22:28:30 UTC

junit - is ther a way to skip teardown method when a test fixture fails?

Hi,

I am working on DERBY-5866 where triggers are intermittently not getting
fired in the order they were created. I got hold of wombat db from such a
failure but it is all clean with no tables left in the db. This is because
of the tearDown() method in TriggerTest class which deletes all the meta
data from the table in order to prepare the database for the next test
fixture. I was wondering is there a way in junit where if a test fails, we
can have it skip the tearDown method so we have a db available to do some
debugging. Appreciate all the help.

regards,
Mamta

Re: junit - is ther a way to skip teardown method when a test fixture fails?

Posted by Mamta Satoor <ms...@gmail.com>.
Thanks Knut. I will work on moving the tearDown() code to setUp() which
then should leave a db behind in case of failure for further debugging.


On Wed, Sep 11, 2013 at 2:04 PM, Knut Anders Hatlen
<kn...@oracle.com>wrote:

> Mamta Satoor <ms...@gmail.com> writes:
>
> > Hi,
> >
> > I am working on DERBY-5866 where triggers are intermittently not
> > getting fired in the order they were created. I got hold of wombat db
> > from such a failure but it is all clean with no tables left in the db.
> > This is because of the tearDown() method in TriggerTest class which
> > deletes all the meta data from the table in order to prepare the
> > database for the next test fixture. I was wondering is there a way in
> > junit where if a test fails, we can have it skip the tearDown method
> > so we have a db available to do some debugging. Appreciate all the
> > help.
>
> I guess it's possible to add a boolean field that's initially false and
> make the test method set it to true if it completes without failure.
>
> Another way might be to move the cleanup code from tearDown() to
> setUp(). Then each test case will still run in a clean environment, but
> we won't have tearDown() remove data that's potentially valuable during
> debugging.
>

Re: junit - is ther a way to skip teardown method when a test fixture fails?

Posted by Knut Anders Hatlen <kn...@oracle.com>.
Mamta Satoor <ms...@gmail.com> writes:

> Hi,
>
> I am working on DERBY-5866 where triggers are intermittently not
> getting fired in the order they were created. I got hold of wombat db
> from such a failure but it is all clean with no tables left in the db.
> This is because of the tearDown() method in TriggerTest class which
> deletes all the meta data from the table in order to prepare the
> database for the next test fixture. I was wondering is there a way in
> junit where if a test fails, we can have it skip the tearDown method
> so we have a db available to do some debugging. Appreciate all the
> help.

I guess it's possible to add a boolean field that's initially false and
make the test method set it to true if it completes without failure.

Another way might be to move the cleanup code from tearDown() to
setUp(). Then each test case will still run in a clean environment, but
we won't have tearDown() remove data that's potentially valuable during
debugging.