问题描述
我不确定出了什么问题。我真的被困在这里,非常感谢您的帮助
注意:我已经安装了最新报告pytest-reporter-html1的软件包
我已将以下代码添加到confest.py中,以将屏幕截图添加到报告中
@pytest.mark.hookwrapper
def pytest_runtest_makereport(item,call):
timestamp = datetime.Now().strftime('%H-%M-%s')
pytest_html = item.config.pluginmanager.getplugin('html')
outcome = yield
report = outcome.get_result()
extra = getattr(report,'extra',[])
if report.when == 'call':
feature_request = item.funcargs['request']
driver = feature_request.getfuncargvalue('browser')
driver.save_screenshot(".\\Screenshots\\" + get_current_test() + '_' + timestamp + ".png")
extra.append(pytest_html.extras.image(".\\Screenshots\\" + get_current_test() + '_' + timestamp + ".png"))
# always add url to report
xfail = hasattr(report,'wasxfail')
if (report.skipped and xfail) or (report.Failed and not xfail):
# only add additional html on failure
extra.append(pytest_html.extras.image(".\\Screenshots\\" + get_current_test() + '_' + timestamp + ".png"))
report.extra = extra
extra.append(pytest_html.extras.image(".\\Screenshots\\" + '_' + timestamp + '.png'))
引发以下内部错误
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)