allure报告可以包含很多详细的信息描述测试用例,包括epic、feature、story、title、issue、testcase、severity等
方法 | 作用 | 说明 |
@allure.epic() | epi描述 | |
@allure.feature() | 模块名称 | 功能点的描述,往下是story |
@allure.story() | 用户故事 | 用户故事,往下是title |
@allure.title(用例的标题) | 用例的标题 | 重命名html报告名称 |
@allure.testcase() | 测试用例的链接地址 | 对应功能测试用例系统里面的case |
@allure.issue() | 缺陷 | 对应缺陷管理系统里面的链接 |
@allure.description() | 用例描述 | 测试用例的描述 |
@allure.step() | 操作步骤 | 测试用例的步骤 |
@allure.severity() | 用例等级 | blocker,critical,normal,minor,trivial |
@allure.link() | 链接 | 定义一个链接,在测试报告展现 |
@allure.attachment() | 附件 | 报告添加附件 |
#test_a.py
import pytest
import allure
@pytest.fixture(scope="session")
def login():
print("前置条件:登录")
@allure.step("步骤1")
def step_1():
print("操作步骤----1")
@allure.step("步骤2")
def step_2():
print("操作步骤----2")
@allure.step("步骤3")
def step_3():
print("操作步骤----3")
@allure.epic("epic对大story的一个描述性标签")
@allure.feature("测试模块")
class TestC:
@allure.testcase("http://www.tc.com")
@allure.issue("https://www.bug.com/")
@allure.title("测试用例的标题")
@allure.story("用户故事:1")
@allure.severity("blocker")
def test_1(self,login):
'''我是用例1的描述内容,看的见我不'''
step_1()
step_2()
@allure.story("用户故事:2")
def test_2(self,login):
print("测试用例2")
step_1()
step_3()
@allure.epic("epic对大story的一个描述性标签")
@allure.feature("模块块2")
class TestC2():
@allure.story("用户故事:33")
def test_3(self,login):
print("测试用例test_3")
step_1()
@allure.story("用户故事:44")
def test_4(self,login):
print("测试用例test_4")
step_3()