我使用python和selenium从事测试自动化工作。我想使用pytest框架及其插件来编写和报告测试。目前正在研究pytest\uhtml插件的报告
根据我的调查,我可能找不到任何解释。我在很多地方看到弹出的一段代码,包括pytest html文档,如下所示:
import pytest
@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_makereport(item, call):
pytest_html = item.config.pluginmanager.getplugin('html')
outcome = yield
report = outcome.get_result()
extra = getattr(report, 'extra', [])
if report.when == 'call':
# always add url to report
extra.append(pytest_html.extras.url('http://www.example.com/'))
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.html('<div>Additional HTML</div>'))
report.extra = extra
但是,我找不到任何解释这个代码。人们只是说'用这个',但它不适合我,我不能让它工作。 我需要帮助。 item和call变量来自哪里?到底传递给结果的是什么
目前没有回答
相关问题 更多 >
编程相关推荐