UnitTest break on failure

Discussion in 'Python' started by Qian Xu, Feb 10, 2009.

  1. Qian Xu

    Qian Xu Guest

    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
     
    Qian Xu, Feb 10, 2009
    #1
    1. Advertising

  2. Qian Xu

    Joe Riopel Guest

    On Tue, Feb 10, 2009 at 11:48 AM, Qian Xu <-ilmenau.de> wrote:
    > 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.
     
    Joe Riopel, Feb 10, 2009
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ilias Lazaridis
    Replies:
    0
    Views:
    582
    Ilias Lazaridis
    Feb 1, 2005
  2. Richard Wesley

    unittest problems

    Richard Wesley, Jul 28, 2003, in forum: Python
    Replies:
    3
    Views:
    283
    John J. Lee
    Jul 30, 2003
  3. Replies:
    0
    Views:
    481
  4. Replies:
    12
    Views:
    975
  5. Paul  Moore
    Replies:
    1
    Views:
    385
    Paul Moore
    Oct 14, 2008
Loading...

Share This Page