058用例公共部分合并

# -*- coding:utf-8 -*-
from unittest1 import *
import unittest
class hebing(unittest.TestCase):        #合并了开始执行测试用例的环境配置,恢复环境的阶段,hebing继承了TestCase类
    def setUp(self):
        print("Start Test!")
    def tearDown(self):
        print("Test End!")
class addtest(hebing):                              #继承了开始执行测试用例的类(hebing)
    def test_He(self):
        a=Math(2,3)
        self.assertEquals(a.add(),5)
class jiantest(hebing):                             #继承了开始执行测试用例的类(hebing)
    def testJian(self):
        b=Math(5,1)
        self.assertNotEqual(b.jian(),3)
if __name__ == '__main__':          
    unittest.main()                                    #直接执行全部的用例

 

你可能感兴趣的:(python)