标签:return time sleep == 测试用例 用例 对象 cas turn
import time
import unittest
def my_sum(a, b):
a += 1
b += 2
return a + b
# 生成测试用例
class TestSum(unittest.TestCase):
def test_001(self):
print(my_sum(1,2))
def test_002(self):
print(my_sum(-1,2))
suite = unittest.TestSuite()
# 将测试用例添加到套件里面
suite.addTest(TestSum(‘test_001‘))
suite.addTest(TestSum(‘test_002‘))
# 执行suite对象中的用例
runner = unittest.TextTestRunner()
runner.run(suite)
if __name__ == ‘__main__‘:
TestSum()
time.sleep(3)
标签:return time sleep == 测试用例 用例 对象 cas turn
原文地址:https://www.cnblogs.com/shixiaoru/p/14924368.html