pytest添加附件到allure报告上

import allure
import pytest


def test_allure_print():
    print("测试print在allure报告上")
    print("测试截图附件在allure报告上")
    with open("attach.png", "rb") as f:
        context = f.read()
        allure.attach(context, "错误图片", attachment_type=allure.attachment_type.PNG)
    allure.attach("附件txt文字", "响应报文", allure.attachment_type.TEXT)

 

pytest添加附件到allure报告上_第1张图片

pytest添加附件到allure报告上_第2张图片

你可能感兴趣的:(pytest)