allure 定制详细报告

默认的allure报告不能详细的显示出来脚本执行的步骤,能做到跟Log里一样的每一步操作。

@allure.step()装饰器来实现。

1
2
3
4
5
6
7
8
9
10
11
12
13
@allure.step("Input text {text} in [{element}]")
def input_text(self, element, text):
"""**Description**:
Fill text to the page_element located by locator

:param element: The locator to locate the page_element.
:param text: value to set to the page_element
:return:
"""

ele = self.find_element(element)
ele.clear()
ele.send_keys(text)
logger.info(f'Input [{text}] in {element}')

运行结果如下:

唐胡璐 wechat
欢迎您扫一扫上面的微信公众号,订阅我的博客!
分享创造价值,您的支持将鼓励我继续前行!