码迷,mamicode.com
首页 > 其他好文 > 详细

allure与测试用例的故事

时间:2020-06-15 17:31:45      阅读:165      评论:0      收藏:0      [点我收藏+]

标签:命令   oss   作者   server   com   lin   cal   issue   mes   

1.allure用例描述

包含:epic,feature, story, title, testcase, issue, description, step, serverity, link, attachment

技术图片

 

 

2.实例应用

import pytest
import allure


@pytest.fixture(scope="session")
def login_fixture():
    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 TestDemoAllure():

    @allure.testcase("http://49.235.x.x:8080/zentao/testcase-view-6-1.html")
    @allure.issue("http://49.235.x.x:8080/zentao/bug-view-1.html")
    @allure.title("用例的标题")
    @allure.story("用户故事:1")
    @allure.severity("critical")
    def test_case_1(self, login_fixture):
        ‘‘‘case description:作者:上海-悠悠 qq交流群:874033608
        1.点文章分类导航标签 -跳转编辑页面
        2.编辑页面输入,分类名称,如:上海-悠悠-可以输入
        3.点保存按钮保存成功
        ‘‘‘
        step_1()
        step_2()

    @allure.story("用户故事:2")
    def test_case_2(self, login_fixture):
        print("测试用例1")
        step_1()
        step_3()


@allure.epic("epic对大Story的一个描述性标签")
@allure.feature("模块2")
class TestDemo2():


    @allure.story("用户故事:3")
    def test_case_3(self, login_fixture):
        print("测试用例1")
        step_1()


    @allure.story("用户故事:4")
    def test_case_4(self, login_fixture):
        print("测试用例1")
        step_3()

测试执行

pytest --alluredir ./report/allure
allure serve ./report/allure

技术图片

 

 

命令行参数解释     

运行哪些标签

--allure-severities=SEVERITIES_SET
                        Comma-separated list of severity names. Tests only
                        with these severities will be run. Possible values
                        are: blocker, critical, normal, minor, trivial.
--allure-epics=EPICS_SET
                        Comma-separated list of epic names. Run tests that
                        have at least one of the specified feature labels.
--allure-features=FEATURES_SET
                        Comma-separated list of feature names. Run tests that
                        have at least one of the specified feature labels.
--allure-stories=STORIES_SET
                        Comma-separated list of story names. Run tests that
                        have at least one of the specified story labels.
--allure-link-pattern=LINK_TYPE:LINK_PATTERN
                        Url pattern for link type. Allows short links in test,
                        like ‘issue-1‘. Text will be formatted to full url
                        with python str.format().

选择运行你要执行epic的用例

pytest --alluredir ./report/allure --allure-epics=epic对大Story的一个描述性标签

选择运行你要执行features的用例

pytest --alluredir ./report/allure --allure-features=模块2

选择运行你要执行features的用例

pytest --alluredir ./report/allure --allure-stories="用户故事:1"

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

allure与测试用例的故事

标签:命令   oss   作者   server   com   lin   cal   issue   mes   

原文地址:https://www.cnblogs.com/bigbox/p/13132066.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!