From 8101e3d47b717afd4863497f9643e2db2d91d4a7 Mon Sep 17 00:00:00 2001 From: mojin <397135766@qq.com> Date: Thu, 2 Feb 2023 17:36:26 +0800 Subject: [PATCH] =?UTF-8?q?1.=E7=94=A8=E4=BE=8B=E7=8E=AF=E5=A2=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/read_exce_yaml_caes.py | 9 ++++++--- test_caes/test_001.py | 4 +--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/common/read_exce_yaml_caes.py b/common/read_exce_yaml_caes.py index 6aa7de0..0137c87 100644 --- a/common/read_exce_yaml_caes.py +++ b/common/read_exce_yaml_caes.py @@ -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' )) diff --git a/test_caes/test_001.py b/test_caes/test_001.py index 0b2c238..1b02561 100644 --- a/test_caes/test_001.py +++ b/test_caes/test_001.py @@ -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):