pytest 生成测试报告

安装依赖

bash 复制代码
pip  install  allure-pytest
pip  install  pytest
pip  install  pytest-html
pip  install  requests

配置 allure

bash 复制代码
下载 allure  并配置环境变量
D:\allure-2.28.0\bin
 配置到 path

执行脚本

bash 复制代码
在项目根目录创建  pytest.ini

配置如下
[pytest]
#  指定  生成 报告的目录
addopts = -s --alluredir=./report
# 脚本 位置
testpaths = ./script
# 测试脚本名称
python_files = *.py
python_classes = Test*
python_functions = test*

生成测试报告

bash 复制代码
# 生成报告 
allure generate ./report -o report/html
# 运行报告 站点
allure open -h 127.0.0.1 -p 8088 report/html
相关推荐
`林中水滴`16 小时前
Linux Shell 命令:nohup、&、>、bg、fg、jobs 总结
linux·服务器·microsoft
ray96316 小时前
Python——函数参数传递方式
开发语言·python
最后一个bug16 小时前
当linux触发panic后进行自定义收尾回调处理
linux·服务器·系统架构·bug
codists16 小时前
2025年12月文章一览
python
梅羽落16 小时前
python武器化开发_01
开发语言·python·php
逍遥德17 小时前
JPA 操作对象图 (Object Graph) 详解
开发语言·python
deephub17 小时前
DeepSeek 开年王炸:mHC 架构用流形约束重构 ResNet 残差连接
人工智能·python·深度学习·神经网络·残差链接
上班职业摸鱼人17 小时前
MMDetection 框架完整教程(从入门到实战,代码可复现)
python
一只旭宝17 小时前
Linux专题十二:mysql数据库以及redis数据库
linux·数据库·mysql
意趣新17 小时前
OpenCV 中摄像头视频采集 + 实时显示 + 视频保存
python·opencv·计算机视觉