下载 allure
下载地址: https://github.com/allure-framework/allure2/releases
配置allure 环境变量
将文件解压
配置环境变量
在Path中添加
运行代码
run.py
"""
运行项目文件
"""
import os
import pytest
# 创建测试报告目录
reports = os.path.join(os.path.dirname(os.path.abspath(__file__)),'reports')
if not os.path.exists(reports):
os.mkdir(reports)
if __name__ == '__main__':
pytest.main(['testcases','-s','-v',f'--alluredir={reports}'])
生成报告
运行完成之后,在项目的跟你目录下执行命令
allure serve reports