1.用例环境

This commit is contained in:
mojin 2023-02-02 17:36:26 +08:00
parent 7762d05e57
commit 8101e3d47b
2 changed files with 7 additions and 6 deletions

View File

@ -16,6 +16,7 @@ from common.operation_excle import operation_excle
from common.logger import Logger
def get_yaml_all_caes(yaml_file):#获取yaml文件中的所有用例
get_all_yaml = ReadFile.read_config(yaml_file) # 获取存放yaml文件目录路径
case_severity_list = ReadFile.read_config('$..case_severity')
yaml_path_all = [] # 收集所有的yaml文件路径
for i in os.listdir(get_all_yaml):
@ -27,7 +28,8 @@ def get_yaml_all_caes(yaml_file):#获取yaml文件中的所有用例
title = one_caselist_path.split('/')[-1].split('.')[0]
for one_case in ReadFile.get_case_data_yaml(one_caselist_path):
(one_case.insert(0, title)) # .insert(0,title)
all_yaml_case.append(one_case)
if one_case[5] in case_severity_list: # 筛选匹配的用例等级进行测试
all_yaml_case.append(one_case)
return all_yaml_case
@ -54,8 +56,9 @@ def get_excle_all_caes(excle_file):#获取excle文件中的所有用例
return all_excle_case
def get_yaml_excle_caes():# get_all_yaml_excle_caes #获取yaml和excle用例用例yaml和excle累计所有
cmdopt_env='test'
def get_yaml_excle_caes(cmdopt_env):# get_all_yaml_excle_caes #获取yaml和excle用例用例yaml和excle累计所有
#cmdopt_env='test'
#Logger.error(cmdopt_env)
test_case_type = (ReadFile.read_config('$.test_case_type.%s'%cmdopt_env))
#test_case_type = (ReadFile.read_config('$.test_case_type' ))

View File

@ -8,16 +8,14 @@
# @Software: PyCharm
#-------------------------------------------------------------------------------
import pytest,allure
from common.assert_api import AssertApi
from common.api_request import Api_Request
from common.read_exce_yaml_caes import get_yaml_excle_caes
#@allure.epic(ReadFile.read_config("$.project_name")) # 项目名称
class Test():
@pytest.mark.parametrize("case",get_yaml_excle_caes())
@pytest.mark.parametrize("case",get_yaml_excle_caes('test'))
@allure.step
def test_001(self,case,get_db,env_url):