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
相关推荐
努力搬砖的咸鱼1 天前
AI Agent测试全景图:它到底改变了什么
人工智能·python·ai·集成测试·pytest·agent·ai编程
X1A0RAN3 天前
自动化流水线提效·微观篇:pytest 执行顺序优化
自动化·pytest
久久学姐10 天前
Python+Playwright+Pytest+BDD,用FSM打造高效测试框架
python·pytest·bdd·playwright·fsm
小白上线*^_^*11 天前
Pytest 自动化测试框架速通指南(二)
软件测试·pytest·python测试框架·ai测试基础
Logintern0912 天前
pytest的AST 断言重写
pytest
Tinyfacture12 天前
接口自动化之添加商品(pytest)
python·测试工具·自动化·pytest
ji_shuke14 天前
从零深入:基于 Playwright + Pytest + Allure 的企业级 Web 端到端自动化测试框架实战
前端·自动化测试·docker·jenkins·pytest·allure·playwright
祉猷并茂,雯华若锦16 天前
Selenium+Pytest自动化测试框架实战
selenium·测试工具·pytest
祉猷并茂,雯华若锦17 天前
Pytest+Selenium自动化测试:失败自动截图集成Allure报告
selenium·测试工具·pytest
我的xiaodoujiao20 天前
API 接口自动化测试详细图文教程学习系列32--Allure测试报告2
python·学习·测试工具·pytest