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
相关推荐
我的xiaodoujiao11 小时前
3、API 接口自动化测试详细图文教程学习系列3--相关Python基础知识2
python·学习·测试工具·pytest
小陈的进阶之路14 小时前
Pytest 框架与 Fixture 总结
笔记·pytest
我的xiaodoujiao16 小时前
4、API 接口自动化测试详细图文教程学习系列4--相关Python基础知识3
python·学习·测试工具·pytest
小罗和阿泽17 小时前
接口测试系列 接口自动化测试 pytest框架(三)
开发语言·python·pytest
独断万古他化1 天前
Python+Pytest 接口自动化测试实战 —— 抽奖系统接口测试框架设计与实现
python·pytest·接口自动化·测试·allure·yaml·json schema
小陈的进阶之路2 天前
Selenium 常用操作 API
python·自动化·pytest
紫丁香2 天前
pytest_自动化测试5
python·功能测试·单元测试·集成测试·pytest
姚青&2 天前
Pytest fixture 参数化(params 参数)
开发语言·python·pytest
小张贼嚣张2 天前
Pytest 核心特性与技术优势
pytest