(testcases, testsuite_config, project_mapping)
return parsed_testcase_list
override testscases with testsuite config variables, base_url and verify.

        variables priority:
        parameters > testsuite config > testcase config > testcase_def config > testcase_def tests > api

        base_url priority:
        testcase_def tests > testcase_def config > testcase config > testsuite config

    Args:
        testcases (dict):
            {
                "testcase1 name": {
                    "testcase": "testcases/create_and_check.yml",
                    "weight": 2,
                    "variables": {
                        "uid": 1000
                    },
                    "parameters": {
                        "uid": [100, 101, 102]
                    },
                    "testcase_def": {
                        "config": {},
                        "teststeps": []
                    }
                },
                "testcase2 name": {}
            }
        testsuite_config (dict):
            {
                "name": "testsuite name",
                "variables": {
                    "device_sn": "${gen_random_string(15)}"
                },
                "base_url": "http://127.0.0.1:5000"
            }
        project_mapping (dict):
            {
                "env": {},
                "functions": {}
            }
override testscases with testsuite config variables, base_url and verify.
override testscases with testsuite config variables base_url and verify .
def __get_parsed_testsuite_testcases(testcases, testsuite_config, project_mapping):
    """ override testscases with testsuite config variables, base_url and verify.

        variables priority:
        parameters > testsuite config > testcase config > testcase_def config > testcase_def tests > api

        base_url priority:
        testcase_def tests > testcase_def config > testcase config > testsuite config

    Args:
        testcases (dict):
            {
                "testcase1 name": {
                    "testcase": "testcases/create_and_check.yml",
                    "weight": 2,
                    "variables": {
                        "uid": 1000
                    },
                    "parameters": {
                        "uid": [100, 101, 102]
                    },
                    "testcase_def": {
                        "config": {},
                        "teststeps": []
                    }
                },
                "testcase2 name": {}
            }
        testsuite_config (dict):
            {
                "name": "testsuite name",
                "variables": {
                    "device_sn": "${gen_random_string(15)}"
                },
                "base_url": "http://127.0.0.1:5000"
            }
        project_mapping (dict):
            {
                "env": {},
                "functions": {}
            }

    """
    testsuite_base_url = testsuite_config.get("base_url")
    testsuite_config_variables = testsuite_config.get("variables", {})
    functions = project_mapping.get("functions", {})
    parsed_testcase_list = []

    for testcase_name, testcase in testcases.items():

        parsed_testcase = testcase.pop("testcase_def")
        parsed_testcase.setdefault("config", {})
        parsed_testcase["path"] = testcase["testcase"]
        parsed_testcase["config"]["name"] = testcase_name

        if "weight" in testcase:
            parsed_testcase["config"]["weight"] = testcase["weight"]

        # base_url priority: testcase config > testsuite config
        parsed_testcase["config"].setdefault("base_url", testsuite_base_url)

        # 1, testsuite config => testcase config
        # override test_dict variables
        testcase_config_variables = utils.extend_variables(
            testcase.pop("variables", {}),
            testsuite_config_variables
        )

        # 2, testcase config > testcase_def config
        # override testcase_def config variables
        parsed_testcase_config_variables = utils.extend_variables(
            parsed_testcase["config"].pop("variables", {}),
            testcase_config_variables
        )

        # parse config variables
        parsed_config_variables = {}

        for key in parsed_testcase_config_variables:
            try:
                parsed_value = parse_data(
                    parsed_testcase_config_variables[key],
                    parsed_testcase_config_variables,
                    functions
                )
            except exceptions.VariableNotFound:
                pass
            parsed_testcase_config_variables[key] = parsed_value
            parsed_config_variables[key] = parsed_value

        if parsed_config_variables:
            parsed_testcase["config"]["variables"] = parsed_config_variables

        # parse parameters
        # print(11)
        # print(testcase)
        # print(testcase["parameters"])
        if "parameters" in testcase and testcase["parameters"]:
            cartesian_product_parameters = parse_parameters(
                testcase["parameters"],
                parsed_config_variables,
                functions
            )

            for parameter_variables in cartesian_product_parameters:
                # deepcopy to avoid influence between parameters
                parsed_testcase_copied = utils.deepcopy_dict(parsed_testcase)
                parsed_config_variables_copied = utils.deepcopy_dict(parsed_config_variables)
                parsed_testcase_copied["config"]["variables"] = utils.extend_variables(
                    parsed_config_variables_copied,
                    parameter_variables
                )
                _parse_testcase(parsed_testcase_copied, project_mapping)
                parsed_testcase_list.append(parsed_testcase_copied)

        else:
            _parse_testcase(parsed_testcase, project_mapping)
            parsed_testcase_list.append(parsed_testcase)

    return parsed_testcase_list
def __get_parsed_testsuite_testcases ( testcases , testsuite_config , project_mapping ) : testsuite_base_url = testsuite_config . get ( "base_url" ) testsuite_config_variables = testsuite_config . get ( "variables" , { } ) functions = project_mapping . get ( "functions" , { } ) parsed_testcase_list = [ ] for testcase_name , testcase in testcases . items ( ) : parsed_testcase = testcase . pop ( "testcase_def" ) parsed_testcase . setdefault ( "config" , { } ) parsed_testcase [ "path" ] = testcase [ "testcase" ] parsed_testcase [ "config" ] [ "name" ] = testcase_name if "weight" in testcase : parsed_testcase [ "config" ] [ "weight" ] = testcase [ "weight" ] # base_url priority: testcase config > testsuite config parsed_testcase [ "config" ] . setdefault ( "base_url" , testsuite_base_url ) # 1, testsuite config => testcase config # override test_dict variables testcase_config_variables = utils . extend_variables ( testcase . pop ( "variables" , { } ) , testsuite_config_variables ) # 2, testcase config > testcase_def config # override testcase_def config variables parsed_testcase_config_variables = utils . extend_variables ( parsed_testcase [ "config" ] . pop ( "variables" , { } ) , testcase_config_variables ) # parse config variables parsed_config_variables = { } for key in parsed_testcase_config_variables : try : parsed_value = parse_data ( parsed_testcase_config_variables [ key ] , parsed_testcase_config_variables , functions ) except exceptions . VariableNotFound : pass parsed_testcase_config_variables [ key ] = parsed_value parsed_config_variables [ key ] = parsed_value if parsed_config_variables : parsed_testcase [ "config" ] [ "variables" ] = parsed_config_variables # parse parameters # print(11) # print(testcase) # print(testcase["parameters"]) if "parameters" in testcase and testcase [ "parameters" ] : cartesian_product_parameters = parse_parameters ( testcase [ "parameters" ] , parsed_config_variables , functions ) for parameter_variables in cartesian_product_parameters : # deepcopy to avoid influence between parameters parsed_testcase_copied = utils . deepcopy_dict ( parsed_testcase ) parsed_config_variables_copied = utils . deepcopy_dict ( parsed_config_variables ) parsed_testcase_copied [ "config" ] [ "variables" ] = utils . extend_variables ( parsed_config_variables_copied , parameter_variables ) _parse_testcase ( parsed_testcase_copied , project_mapping ) parsed_testcase_list . append ( parsed_testcase_copied ) else : _parse_testcase ( parsed_testcase , project_mapping ) parsed_testcase_list . append ( parsed_testcase ) return parsed_testcase_list