【pytest-22】allure特性之epic,feature,story,title
前言
- @allure.epic:敏捷里面的概念,定义史诗,往下是 feature
- @allure.feature:功能点的描述,理解成模块往下是 story
- @allure.story:故事,往下是 title
- @allure.title:用例的标题
示例:
#encoding:utf-8 #@Time:2020/12/21 11:32 #@Author:sunny import allure from common.com_utils import * import pytest ''' 1.登录,2.查询数据 3.编辑 4.保存 ''' def login(username,password): '''前置操作1:登录''' print("前置操作:先登录") def search(): print("搜索") def edit(id="23"): print("编辑增加") def save(): print("保存") @pytest.fixture(scope="session") def login_setup(): login("xiaoxiao","123") @allure.epic("我是epic") @allure.feature("我feature,是排期模块") class TestA(): @allure.story("我是story1") @allure.title("我是添加保存用例") def test_add_save(login_setup): # ''' # 测试添加和保存 # :return: # ''' with allure.step('步骤2:搜索'): search() with allure.step('步骤3:编辑增加'): edit() with allure.step('步骤4:保存'): save() @allure.story("我是story2") @allure.title("保存成功用例") def test_save_success(login_setup): pass @allure.epic("我是函数的epic") @allure.title("我是函数的title") @allure.feature("我是函数的feature2") @allure.story("我是函数的story3") def test_aa(): with allure.step('步骤2:搜索'): search() with allure.step('步骤3:编辑增加'): edit() with allure.step('步骤4:保存'): save()
运行结果:

注:由上可知,epic和feature装饰器最好是在类,方法上去实现,如果用例多了,这样看起来很杂,不层次分明。
善于跌倒仍喜爱奔跑~

浙公网安备 33010602011771号