如果自己想写测试框架,这个是非常重要的,视野之一:
如果写测试case,下面的是重要的应用方法:
8个TestCase, 见下面:
class MyTest(unittest.TestCase):
@classmethod
def setUpClass(self):
self.myclassa = MyClass1()
def setUp(self):
MyTest.__unittest_skip__ = False
self.__class__.unittest_skip__ = False
MyTest.__unittest_expecting_failure__ = False
self.__class__.__unittest_expecting_failure__ = False
def test_01sum(self, a = 4, b = 5):
self.__class__.__unittest_expecting_failure__ = True
self.assertEqual(self.myclassa.addMy(a, b), a * b)
def test_02sum(self, a = 3, b = 4):
MyTest.__unittest_expecting_failure__ = True
self.assertEqual(self.myclassa.addMy(a, b), a * b)
def test_03sum(self, a = 9, b = 10):
self.assertEqual(self.myclassa.addMy(a,