前置:pytest和allure已经安装好了
pytest安装
pip install pytest
allure安装(官方安装包,配环境:在path那里加上安装路径\bin)
allure的使用
1、在你的项目根目录创建pytest.ini文件,没有就新建一个
目录中就会出现
内容写下面的代码,作用是运行 pytest 时自动生成temps目录及临时报告数据。
[pytest]
addopts = -vs --alluredir=./temps --clean-alluredir
2、在命令行中先运行pytest,再输入以下命令,就能打开allure报告了。
# 生成 HTML 报告到 allure-report 目录
allure generate ./temps -o ./allure-report --clean
# 打开报告(自动在浏览器中显示)
allure open ./allure-report
3、成功界面