import pytest
import allure
@pytest.hookimpl(tryfirst=True,hookwrapper=True)
def pytest_runtest_makereport(item,call):
out=yield
res=out.get_result()
# with nose.allure.step('step one'):
if res.when=='call' and res.failed:
# filename=res.nodeid.split('::')[-1]
# save_pic(driver,filename)
if hasattr(driver,'get_screenshot_as_png'):
with allure.step("添加用例失败截图"):
allure.attach(driver.get_screenshot_as_png(),'失败截图',allure.attachment_type.PNG)
pytest+allure错误截图
最新推荐文章于 2024-09-06 20:39:54 发布