Loading

4.pytest结合allure-pytest插件生成allure测试报告

之前我们使用的测试报告插件是pytest-html
这次使用的插件是allure-pytest,更加美观强大

安装插件

pip3 install allure-pytest
安装allure(Mac)
#Mac可以直接使brew安装,会自动配置环境变量
#如果是Windows,去下载压缩包,解压然后配置环境变量即可
 brew install allure
生成json格式的临时报告

运行参数 :--alluredir 临时报告目录
pytest.main(['--alluredir=./temp'])
#pytest.ini配置
addopts = -vs --alluredir ./temp
将临时报告生成allure报告
import os
os.system('allure generate 临时json报告目录 -o allure报告目录 --clean')

#allure generate 固定命令
# -o 输出
#--clean 清空目录下原来的报告

posted @ 2022-05-04 11:26  木子七  阅读(174)  评论(0编辑  收藏  举报