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
相关推荐
风逸hhh1 小时前
python打卡day46@浙大疏锦行
开发语言·python
火兮明兮2 小时前
Python训练第四十三天
开发语言·python
Gaoithe3 小时前
ubuntu 端口复用
linux·运维·ubuntu
互联网杂货铺3 小时前
完美搭建appium自动化环境
自动化测试·软件测试·python·测试工具·职场和发展·appium·测试用例
Gyoku Mint3 小时前
机器学习×第二卷:概念下篇——她不再只是模仿,而是开始决定怎么靠近你
人工智能·python·算法·机器学习·pandas·ai编程·matplotlib
德先生&赛先生3 小时前
Linux编程:1、文件编程
linux
莱茵菜苗3 小时前
Python打卡训练营day46——2025.06.06
开发语言·python
爱学习的小道长3 小时前
Python 构建法律DeepSeek RAG
开发语言·python
程序猿小D4 小时前
第16节 Node.js 文件系统
linux·服务器·前端·node.js·编辑器·vim
luojiaao4 小时前
【Python工具开发】k3q_arxml 简单但是非常好用的arxml编辑器,可以称为arxml杀手包
开发语言·python·编辑器