标签:from testcase 执行 main import name self rdo start
from testcase1 import count
import unittest
class MyTest(unittest.TestCase):
def setUp(self):
print(‘test start‘)
def tearDown(self):
print(‘test end‘)
class TestCount(unittest.TestCase):
def test_add(self):
j=count(3,2)
self.assertEqual(j.add(),5)
def test_add2(self):
j=count(3,4)
self.assertEqual(j.add(),7)
if __name__ == ‘__main__‘:
# unittest.main()
#构造测试集 单个案例
suite=unittest.TestSuite()
suite.addTest(TestCount(‘test_add2‘))
#执行测试集
runner=unittest.TextTestRunner()
runner.run()
标签:from testcase 执行 main import name self rdo start
原文地址:https://www.cnblogs.com/panpan8554/p/11724055.html