import unittestclass Study(unittest.TestCase): # def setUp(self): # print(‘start‘) # def tearDown(self): # print(‘end‘) def test_login(self): print(‘login‘) def test_draft(self): print(‘draft‘) def test_logout(self): print(‘logout‘) def xixi(self): #非test开头,不执行 print(‘hehe‘)if __name__=="__main__": #unittest.main() #默认执行属性按0-9,A-Z,a-z #使用TestSuite则将此句屏蔽掉 ss=unittest.TestSuite() ss.addTest(Study(‘test_login‘)) ss.addTest(Study(‘test_draft‘)) ss.addTest(Study(‘test_logout‘)) rr=unittest.TextTestRunner() rr.run(ss)
原文地址:https://www.cnblogs.com/canglongdao/p/11968061.html
时间: 2024-10-09 06:32:29