首页 > 其他分享 >unittest

unittest

时间:2023-02-08 16:03:16浏览次数:29  
标签:unittest TestLegion test suite self def

import unittest
class TestLegion(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_createlegion(self):
self.assertEqual(2,1)
@unittest.skip('test_bless') #跳过这个用例
def test_bless(self):
self.assertEqual(1,1)
def test_receive_box(self):
self.assertEqual(1,1)
def test_quit(self):
self.assertEqual(1,1)
if __name__=='__main__':
suite=unittest.TestSuite()
suite.addTest(TestLegion('test_createlegion'))
suite.addTest(TestLegion('test_bless'))
suite.addTest(TestLegion('test_receive_box'))
suite.addTest(TestLegion('test_quit'))
unittest.TextTestRunner(verbosity=2).run(suite)



添加类Abc中的所有用例 suite=unittest.TestLoader().loadTestsFromTestCase(Abc)

标签:unittest,TestLegion,test,suite,self,def
From: https://www.cnblogs.com/2023-1-6/p/17102117.html

相关文章