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
相关推荐
Xiu Yan10 分钟前
Python 数据分析:Pandas DataFrame 零基础入门教程
python·jupyter·pycharm·numpy·pandas
别动我齐刘海16 分钟前
ROS2 Jazzy + C++ 实战路线——ros2_control
c++·人工智能·python·opencv·机器学习·机器人·github
whyutianict_vv34 分钟前
云计算运维培训课程技术栈拆解:从 Linux 网络到 AI 推理的五层能力分层
linux·云计算
把头塞进显示器1 小时前
电商平台-测试报告
python·selenium·pytest
ShyanZh1 小时前
【Python3基础】01-Python 环境与开发工具
python
醇氧1 小时前
Git 合并冲突与`__pycache__` 的恩怨情仇
python·numpy·fastapi
xiaoye-duck1 小时前
《Linux 网络编程》深入理解数据链路层:从MAC帧到ARP协议的底层原理详解
linux·网络
ShyanZh1 小时前
【Python3基础】02-输入输出与程序运行
python
伞伞悦读1 小时前
【第39期】Python 第三方包安装详解:pip、conda、requirements、版本锁定和镜像源
python·conda·pip
Jialu.2 小时前
第7篇:舆情预警系统:三类规则引擎 + 飞书/钉钉 Webhook 通知
python·安全