1.用例环境
This commit is contained in:
parent
7762d05e57
commit
8101e3d47b
|
@ -16,6 +16,7 @@ from common.operation_excle import operation_excle
|
||||||
from common.logger import Logger
|
from common.logger import Logger
|
||||||
def get_yaml_all_caes(yaml_file):#获取yaml文件中的所有用例
|
def get_yaml_all_caes(yaml_file):#获取yaml文件中的所有用例
|
||||||
get_all_yaml = ReadFile.read_config(yaml_file) # 获取存放yaml文件目录路径
|
get_all_yaml = ReadFile.read_config(yaml_file) # 获取存放yaml文件目录路径
|
||||||
|
case_severity_list = ReadFile.read_config('$..case_severity')
|
||||||
yaml_path_all = [] # 收集所有的yaml文件路径
|
yaml_path_all = [] # 收集所有的yaml文件路径
|
||||||
|
|
||||||
for i in os.listdir(get_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]
|
title = one_caselist_path.split('/')[-1].split('.')[0]
|
||||||
for one_case in ReadFile.get_case_data_yaml(one_caselist_path):
|
for one_case in ReadFile.get_case_data_yaml(one_caselist_path):
|
||||||
(one_case.insert(0, title)) # .insert(0,title)
|
(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
|
return all_yaml_case
|
||||||
|
|
||||||
|
@ -54,8 +56,9 @@ def get_excle_all_caes(excle_file):#获取excle文件中的所有用例
|
||||||
|
|
||||||
return all_excle_case
|
return all_excle_case
|
||||||
|
|
||||||
def get_yaml_excle_caes():# get_all_yaml_excle_caes #获取yaml和excle用例,用例;yaml和excle累计所有
|
def get_yaml_excle_caes(cmdopt_env):# get_all_yaml_excle_caes #获取yaml和excle用例,用例;yaml和excle累计所有
|
||||||
cmdopt_env='test'
|
#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.%s'%cmdopt_env))
|
||||||
#test_case_type = (ReadFile.read_config('$.test_case_type' ))
|
#test_case_type = (ReadFile.read_config('$.test_case_type' ))
|
||||||
|
|
||||||
|
|
|
@ -8,16 +8,14 @@
|
||||||
# @Software: PyCharm
|
# @Software: PyCharm
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
import pytest,allure
|
import pytest,allure
|
||||||
|
|
||||||
from common.assert_api import AssertApi
|
from common.assert_api import AssertApi
|
||||||
from common.api_request import Api_Request
|
from common.api_request import Api_Request
|
||||||
from common.read_exce_yaml_caes import get_yaml_excle_caes
|
from common.read_exce_yaml_caes import get_yaml_excle_caes
|
||||||
|
|
||||||
|
|
||||||
#@allure.epic(ReadFile.read_config("$.project_name")) # 项目名称
|
#@allure.epic(ReadFile.read_config("$.project_name")) # 项目名称
|
||||||
class Test():
|
class Test():
|
||||||
|
|
||||||
@pytest.mark.parametrize("case",get_yaml_excle_caes())
|
@pytest.mark.parametrize("case",get_yaml_excle_caes('test'))
|
||||||
@allure.step
|
@allure.step
|
||||||
def test_001(self,case,get_db,env_url):
|
def test_001(self,case,get_db,env_url):
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue