Loading

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))
posted @ 2021-08-25 16:46  DuKe渡客  阅读(1661)  评论(0编辑  收藏  举报