# -*- coding: UTF-8 -*- """ @Project :pytest_src @File :test_case.py @Author :haojiang @Date :2022/9/23 10:09 """ import pytest from Base.ModuleCfgCheck import ModuleCfgCheck, check_module_param_check from Data.DataAccess import ItemType, get_xlsx_data_by_item_type PROJECT = r'D:\01_Work\02_WP\EP39_EV\branch\src\Config\ECUC' @pytest.mark.parametrize("module_name, param_name, expect_value", get_xlsx_data_by_item_type(ItemType.FIXED_VALUE)) def test_01_case(module_name, param_name, expect_value): ''' 该用例适用于 对某一配置项值进行检查,可能有多个container 都具有该配置项,但所有配置项的值都相同,为一固定值。 当有一个值与预期值不匹配时,将报错。 :param module_name: :param param_name: :param expect_value: :return: ''' item = (param_name, expect_value) res = check_module_param_check(PROJECT, module_name, item) assert True == res @pytest.mark.parametrize("module_name, search_pattern, param_name, expect_value", get_xlsx_data_by_item_type(ItemType.CUSTOM_PATTERN)) def test_02_case(module_name, search_pattern, param_name, expect_value): ''' 该用例适用于测试 通过某种模式规则,定位到唯一的container, 该container包含的指定配置项,是否与期望值相同。 例如,可能多个container 都具有该配置项,但对于目标container, 可能和其他container 配置值不同。 :param module_name: :param search_pattern: :param param_name: :param expect_value: :return: ''' item = (param_name, expect_value) res = check_module_param_check(PROJECT, module_name, item, search_pattern) assert True == res @pytest.mark.parametrize("module_name, search_pattern, param_name, expect_value", get_xlsx_data_by_item_type(ItemType.DEPENDENCY_PATTERN)) def test_03_case(module_name, search_pattern, param_name, expect_value): # 该测试用例,用于目标container 需要使用 依赖关系才能确定确定的场景。 print(module_name, search_pattern, param_name, expect_value) assert True == False pass