当我使用[pytest-html-reporter]时,有没有办法为每个测试提供自定义消息https://pypi.org/project/pytest-html-reporter/?
我在测试中尝试了打印和日志记录语句,但它们没有显示在报告中。
我将 pytest 测试称为如下:
pytest --cache-clear -v -s --capture=tee-sys --html-report=./Reports/report.html --title='仪表板' --self-contained-html .\DASHBOARD\Tests est_dashboard.py
报告仅显示套件、测试用例名称、状态、时间、错误消息。
非常感谢任何帮助。
就我而言,我编写了一个自定义 HTML,它允许我向 HTML 添加注释。 pytest-html-reporter 支持添加自定义 HTML,因此您可以添加一个函数来使用额外的修复程序来执行此操作:
示例:
def test_extras(extra):
extra.append(
{
"name": "Text",
"format": "text",
"content": "<lorem ipsum> " * 100,
})