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
相关推荐
失败尽常态52334 分钟前
用Python实现Excel数据同步到飞书文档
python·excel·飞书
2501_9044477436 分钟前
OPPO发布新型折叠屏手机 起售价8999
python·智能手机·django·virtualenv·pygame
青龙小码农36 分钟前
yum报错:bash: /usr/bin/yum: /usr/bin/python: 坏的解释器:没有那个文件或目录
开发语言·python·bash·liunx
大数据追光猿42 分钟前
Python应用算法之贪心算法理解和实践
大数据·开发语言·人工智能·python·深度学习·算法·贪心算法
Leuanghing1 小时前
【Leetcode】11. 盛最多水的容器
python·算法·leetcode
打不了嗝 ᥬ᭄2 小时前
Linux的权限
linux
落幕2 小时前
C语言-进程
linux·运维·服务器
深度Linux2 小时前
C++程序员内功修炼——Linux C/C++编程技术汇总
linux·项目实战·c/c++
xinxiyinhe2 小时前
如何设置Cursor中.cursorrules文件
人工智能·python
诸神缄默不语3 小时前
如何用Python 3自动打开exe程序
python·os·subprocess·python 3