本文介绍: 1、allure定义分类层级,由大到小依次为“epic”(迭代)、“feature”(需求),“story”(场景),“title”(功能点),可以根据实际项目使用全部或部分。2、每个测试用例中增加step描述展示执行步骤的含义,既可以项目干系人体测试思路,又可以测试问题后清晰向他人描述问题

官方实例

# content of pytest_quick_start_test.py
import allure

pytestmark = [allure.epic("My first epic"), allure.feature("Quick start feature")]


@allure.id(1)
@allure.story("Simple story")
@allure.title("test_allure_simple_test displayName")
def test_allure_simple_test():
    with allure.step("Simple step"):
        pass

    with allure.step("Simple parent step"):
        with allure.step("Simple child step"):
            pass

    simple_step_func("function parameter")


@allure.step("Simple function with step decorator")
def simple_step_func(param):
    with allure.step(f"function parameter: {param}"):
        pass
    with allure.step("Simple step inside test function"):
        pass

解读实操

  1. 运行代码

    在这里插入图片描述

  2. 生成报告

在这里插入图片描述

  1. 查看报告

在这里插入图片描述

场景应用

1、allure是定义分类层级,由大到小依次为“epic”(迭代)、“feature”(需求),“story”(场景),“title”(功能点),可以根据实际项目使用全部或部分。仅仅为了进行分类。

2、每个测试用例中增加step描述展示执行步骤的含义,既可以向项目干系人体现测试思路,又可以在测试出问题后清晰向他人描述问题

原文地址:https://blog.csdn.net/yyjbluesword/article/details/134801067

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任

如若转载,请注明出处:http://www.7code.cn/show_48968.html

如若内容造成侵权/违法违规/事实不符,请联系代码007邮箱suwngjj01@126.com进行投诉反馈,一经查实,立即删除

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注