4.pytest结合allure-pytest插件生成allure测试报告
阅读原文时间:2023年07月08日阅读:1

之前我们使用的测试报告插件是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 清空目录下原来的报告

手机扫一扫

移动阅读更方便

阿里云服务器
腾讯云服务器
七牛云服务器

你可能感兴趣的文章