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
相关推荐
名字还没想好☜2 天前
用 pytest fixture 组织可维护的测试:告别一堆重复的 setUp
数据库·python·oracle·pytest·测试
自动化和Linux3 天前
【pytest在pycharm中运行与CMD命令运行区别一】
python·pycharm·pytest
博观而约取厚积而薄发5 天前
Pytest 从入门到精通,一篇就够(超详细实战教程)
python·测试工具·单元测试·自动化·pytest
imzed5 天前
使用 Playwright + Pytest 构建 Web UI 自动化测试框架
python·自动化·pytest
普通网友5 天前
pytest一些常见的插件
开发语言·python·pytest
测试老哥7 天前
Pytest自动化测试详解
自动化测试·软件测试·python·测试工具·测试用例·pytest·接口测试
糖果店的幽灵1 个月前
软件测试接口测试从入门到精通:Python接口自动化 - pytest测试框架
软件测试·python·功能测试·自动化·pytest·接口测试
2601_961875241 个月前
花生十三资料1200题|题库|刷题
conda·pytest·pillow·pip·web3.py·ipython·gunicorn
某人辛木1 个月前
Web自动化测试
前端·python·pycharm·pytest