pytest フレームワーク -- アリュール レポートのユースケース パラメーターの詳細な説明

元のリンク、著者に感謝: http://www.manongjc.com/detail/18-uxknglitylthfjx.html

1. テストケース:

#test_allure_demo.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()  

2. レポートを実行して開きます。
ユースケースを実行します: pytest -vs test_allure_demo.py --alluredir ./report/a 、
ここに画像の説明を挿入
レポートを開きます: allureserve ./report/a
ここに画像の説明を挿入
3. Allure レポート ページ
ここに画像の説明を挿入
4. ユースケースを実行しますオンデマンド:
a. [エピックを実装するユース ケースを実行する] を選択します:
pytest --alluredir ./report/allure --allure-epics=epic 大きなストーリーの説明的なラベル
b. 実装するユース ケースを実行することを選択します。機能の実装:
pytest --alluredir ./report /allure --allure-features=module block 2
c. 機能を実装するユースケースの実行を選択します:
pytest --alluredir ./report/allure --allure-stories= 「ユーザーストーリー:1」

おすすめ

転載: blog.csdn.net/weixin_45422695/article/details/121775307