其他分享
首页 > 其他分享> > 【allure】allure.dynamic动态生成用例标题

【allure】allure.dynamic动态生成用例标题

作者:互联网

import pytest,requests,os
from api.login import login
from config.root_path import root_path
from common.read_yaml import readyml
import allure

path = os.path.join(root_path,'data','test_login.yml')
test_data = readyml(path)

@pytest.mark.login
@pytest.mark.parametrize("test_input,expected", test_data)
def test_login_case(base_url,test_input,expected):
    '''登录用例'''
    # print("测试输入:", test_input)
    s = requests.session()
    r = login(s,base_url,test_input["username"],test_input["password"])

    allure.dynamic.title(expected["msg"])

    assert r.json()["code"] == expected["code"]
    assert r.json()["msg"] == expected["msg"]

标签:dynamic,用例,allure,import,test,path,login
来源: https://www.cnblogs.com/xwltest/p/16600257.html