pytest批量执行多个测试文件(批量执行一个文件夹下的所有测试用例)

图片

代码
#!/usr/bin/env python
# @File    : test_runall.py


import pytest
import os



# path = os.path.dirname(__file__)
# path = path + "/report/"
# pytest.main(["-s","--alluredir={}".format(path),
#             "test_case"])#运行 test_case下所有测试用例



pytest.main(["-s", "--alluredir=report", "test_case"] )  # 运行 cases下所有测试用例
result = os.system(r"allure serve {}".format(path))
print("result={}".format(result))
人最大的问题是总是带着成见去看待人和事!
原文地址:https://www.cnblogs.com/liuyanhang/p/15185781.html