unittest同业务批量执行,如果有一条用例失败将失败

 

 

import unittest

class SetupEndDef(unittest.TestCase):

    def setUp(self):

        pass
    def tearDown(self):

        pass

    def kkk(self):
        print("222222222")
        return 1
    def test_aaa1(self):
        s = 0
        a = 1
        print("l1")

        try:
            self.assertTrue(self.kkk())
        except AssertionError as e:
            print(e)
            s += 1
        b = 2
        try:
            self.assertEqual(a,1)
        except AssertionError:
            s += 1
        print("l2")
        self.assertEqual(b,2)

 

posted @ 2020-09-30 14:46  测试艺术家  阅读(223)  评论(0编辑  收藏  举报