Pytest学习笔记(12)-allure特性·@allure.step()和allure.attach

allure.step()和allure.attach
前言

allure除了支持常用的pytest功能外( xfails、fixture、skips和skipif、parametrize),自身还有一些强大实用的功能。

本次主要介绍step和attach功能,可以设置测试步骤及添加报告中的附件。

@allure.step()
  • Allure 报告的最重要的方面是它允许对每个测试用例的调用进行非常详细的步骤说明
  • 通过@allure.step装饰器来实现
  • 可以存储在您的测试之外,并在需要时仅导入
  • Step 方法可以具有任意深度的嵌套结构
demo代码
# __File__   = test_01.py
import allure
from .steps import imported_step

@allure.step("step-1")
def passing_step():
    pass

@allure.step("step-2")
def step_with_nested_steps():
    nested_step()
    
@allure.step("step-3")
  • 1
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值