Test method stops when assertion fails
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Kris_Barrett
Posted On:   Friday, June 27, 2008 02:37 PM

Please forgive me, I am new to JUnit so sorry if this is a dumb question. Is there a way to configure JUnit so it continues running even when an assertion fails? My test method has multiple assertions and I want to see if those assertions pass even if one before it does not. I suppose I could just catch the exception, but I just wanted to see if there is a better way of doing this. Just to be clear, by assertion I mean, Assert.assertEquals(), Assert.assertTrue(), Assert.assertFalse(), etc. Thanks for the help.

Re: Test method stops when assertion fails

Posted By:   Ravi_Kota  
Posted On:   Tuesday, July 1, 2008 09:57 AM

Hi Kris,

I'm not sure if you could catch when assertion fails. I believe what you get is Error object than an Exception object. So as Java specs says that Error and Runtime Exceptions are not to be caught. Even I'm new to this world, but this is what I understand.

Now regarding your question, how could you continue even if one assertion fails? I'm not aware of How and would be curious to know.
About | Sitemap | Contact