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
相关推荐
奶茶精Gaaa4 天前
pytest
pytest
霍格沃兹测试开发学社测试人社区6 天前
软件测试学习笔记丨Pytest 学习指南
软件测试·笔记·测试开发·学习·pytest
神即道 道法自然 如来8 天前
测试面试题:pytest断言时,数据是符点类型,如何断言?
pytest
high_tea8 天前
pytest - 多线程提速
python·pytest
傻啦嘿哟10 天前
自动化测试框架集成:将Selenium集成到pytest与unittest中
selenium·测试工具·pytest
一名在八月份找工作的测试员10 天前
自动化学习1:pytest自动化框架的基本用法:注意事项/断言assert/测试结果分析
学习·自动化·pytest
什么时候才能变强11 天前
Pytest-如何将allure报告发布至公司内网
linux·服务器·pytest
一名在八月份找工作的测试员11 天前
自动化学习2:pytest的高级用法(mark标记/fixture/hook)
学习·自动化·pytest
测试199812 天前
Python+requests+pytest+allure自动化测试框架
自动化测试·软件测试·python·测试工具·职场和发展·测试用例·pytest