[英]Pytest Selenium Allure report : Report multiple failures inside a same test
如果你从allure.step
内部allure.step
块失败将被标记为红色或黄色(取决于失败原因) >标志
with allure.step(description):
do_something()
您可以使用自己的装饰器 (@soft_step) 而不是诱人的 (@step)。
def soft_step(step_title: str):
def decorator(func):
@wraps(func)
def wrapper(*args, **kwargs):
try:
with allure.step(step_title):
func(*args, **kwargs)
except:
allure.attach(browser.driver.get_screenshot_as_png(),
attachment_type=AttachmentType.PNG)
return wrapper
return decorator
注意:它不会使报告中的测试用例失败。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.