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
相关推荐
这个人懒得名字都没写5 小时前
Python包管理新纪元:uv
python·conda·pip·uv
有泽改之_5 小时前
leetcode146、OrderedDict与lru_cache
python·leetcode·链表
starvapour5 小时前
Ubuntu的桌面级程序开机自启动
linux·ubuntu
哇哈哈&5 小时前
gcc9.2的离线安装,支持gcc++19及以上版本
linux·运维·服务器
是毛毛吧5 小时前
边打游戏边学Python的5个开源项目
python·开源·github·开源软件·pygame
三途河畔人5 小时前
Pytho基础语法_运算符
开发语言·python·入门
___波子 Pro Max.6 小时前
Linux快速查看文件末尾字节方法
linux
独行soc7 小时前
2025年渗透测试面试题总结-275(题目+回答)
网络·python·安全·web安全·网络安全·渗透测试·安全狮
Caster_Z7 小时前
WinServer安装VM虚拟机运行Linux-(失败,云服务器不支持虚拟化)
linux·运维·服务器
少废话h8 小时前
Redis主从与集群搭建全指南
大数据·linux·redis·mysql