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
相关推荐
编程之升级打怪2 分钟前
用Python语言实现简单的Redis缓冲数据库驱动库
redis·python
电商API&Tina1 小时前
电商数据采集API接口||合规优先、稳定高效、数据精准
java·javascript·数据库·python·json
玲娜贝儿--努力学习买大鸡腿版1 小时前
hot 100 刷题记录(1)
数据结构·python·算法
兮℡檬,1 小时前
答题卡识别判卷
开发语言·python·计算机视觉
123过去1 小时前
pixiewps使用教程
linux·网络·测试工具·算法·哈希算法
阆遤1 小时前
利用TRAE对nanobot进行安全分析并优化
python·安全·ai·trae·nanobot
H_老邪2 小时前
Linux 与 Docker 常用命令
linux·运维·服务器·docker
雕刻刀2 小时前
ERROR: Failed to build ‘natten‘ when getting requirements to build wheel
开发语言·python
何双新2 小时前
Odoo 技术演进全解析:从 Widget 到 Owl,从 Old API 到声明式 ORM
python
yewq-cn2 小时前
linux 内核设备号
linux·运维·服务器