UnitTest break on failure

Q

Qian Xu

Hi All,

i am writing unit tests and have got a problem:
I want to test some code sequence like:

self.assertEquals(testMethod1(), expected_value1);
self.assertEquals(testMethod2(), expected_value2);

However, if the first test item is failed, no more tests will be executed.
Can I tell Python,
1. go ahead, if a failure is occurred.
2. stop, if an error is occurred?


Best regards,
Qian Xu
 
J

Joe Riopel

self.assertEquals(testMethod1(), expected_value1);
self.assertEquals(testMethod2(), expected_value2);

However, if the first test item is failed, no more tests will be executed.
Can I tell Python,
1. go ahead, if a failure is occurred.
2. stop, if an error is occurred?

Typically you would have a different test for two different methods,
one for each method.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,167
Latest member
SusanaSwan
Top