TestSuite 测试固件
一、
import unittest
class F6(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test\_001(self):
pass
def test\_002(self):
pass
if __name__ == '__main__':
"""使用套件 Makesuite 可以执行F6类的所有执行用例"""
suite = unittest.TestSuite(unittest.makeSuite(F6))
unittest.TextTestRunner(verbosity=2).run()
二、
import unittest
class Baidu_Test(unittest.TestCase):
@classmethod
def setUpClass(cls):
pass
@classmethod
def tearDownClass(cls):
pass
def test\_baidu\_news(self):
pass
def test\_baidu\_map(self):
pass
if __name__ == '__main__':
"""测试套件suite,1、分别测试Baidu\_Test类的方法;2、可直接执行Baidu\_Test类"""
suite = unittest.TestSuite()
suite.addTest(Baidu\_Test())
# suite.addTest(Baidu_Test("test_baidu_news"))
# suite.addTest(Baidu_Test("test_baidu_map"))
unittest.TextTestRunner(verbosity=2).run(suite)
手机扫一扫
移动阅读更方便
你可能感兴趣的文章