pytest pytest-html优化样式

conftest.py

python 复制代码
import pytest
from pytest_metadata.plugin import metadata_key



def pytest_html_report_title(report):
    report.title="接口测试报告"



def pytest_configure(config):
    # 获取命令行参数中的测试环境、测试版本、开始时间、测试人员
    config.stash[metadata_key]["测试环境"] = 'K'
    config.stash[metadata_key]["测试版本"] = 'V我50'
    config.stash[metadata_key]["开始时间"] = strftime("%Y-%m-%d %H:%M:%S")
    config.stash[metadata_key]["测试人员"] = '坤坤'


def pytest_html_results_summary(prefix, summary, postfix):
    prefix.extend(["<p>涉及测试模块如:test1,test2</p>"])

默认展开log

pytest.ini

python 复制代码
[pytest]
addopts = -p no:warnings
render_collapsed = failed,error
相关推荐
2601_961875246 小时前
花生十三资料1200题|题库|刷题
conda·pytest·pillow·pip·web3.py·ipython·gunicorn
某人辛木15 小时前
Web自动化测试
前端·python·pycharm·pytest
淡漠的蓝精灵3 天前
pytest-xdist:把 pytest 测试分发到多核 CPU 执行
其他·pytest
弹简特4 天前
【接口自动化】03-YAML详解及Parametrize数据驱动
自动化·pytest
007张三丰6 天前
软件测试专栏(11/20):测试框架开发:pytest深度解析与插件体系
运维·服务器·自动化测试·pytest·测试框架
我的xiaodoujiao6 天前
API 接口自动化测试详细图文教程学习系列25--继续处理testCase中的数据
python·学习·测试工具·pytest
xiaobai1787 天前
pytest+playwright实现UI自动化(4)-上夹具fixture
ui·自动化·pytest·playwright
弹简特7 天前
【接口自动化】02-Pytest固件fixture核心机制与Allure企业级报告实战
自动化·pytest·测试
弹简特9 天前
【接口自动化】01-pytest详解、pytest执行逻辑、pytest参数、配置文件和pytest标记
自动化·pytest
香辣西红柿炒蛋9 天前
pytest框架介绍
python·pytest