(tests, config, project_mapping)
override tests with testcase config variables, base_url and verify.
        test maybe nested testcase.

        variables priority:
        testcase config > testcase test > testcase_def config > testcase_def test > api

        base_url priority:
        testcase test > testcase config > testsuite test > testsuite config > api

        verify priority:
        testcase teststep (api) > testcase config > testsuite config

    Args:
        tests (list):
        config (dict):
        project_mapping (dict):
override tests with testcase config variables, base_url and verify.
        test maybe nested testcase.
override tests with testcase config variables base_url and verify . test maybe nested testcase .
def __parse_testcase_tests(tests, config, project_mapping):
    """ override tests with testcase config variables, base_url and verify.
        test maybe nested testcase.

        variables priority:
        testcase config > testcase test > testcase_def config > testcase_def test > api

        base_url priority:
        testcase test > testcase config > testsuite test > testsuite config > api

        verify priority:
        testcase teststep (api) > testcase config > testsuite config

    Args:
        tests (list):
        config (dict):
        project_mapping (dict):

    """
    config_variables = config.get("variables", {})
    config_base_url = config.pop("base_url", "")
    config_verify = config.pop("verify", False)
    functions = project_mapping.get("functions", {})

    for test_dict in tests:

        # base_url & verify: priority test_dict > config
        if (not test_dict.get("base_url")) and config_base_url:
            test_dict["base_url"] = config_base_url

        # 1, testcase config => testcase tests
        # override test_dict variables
        test_dict["variables"] = utils.extend_variables(
            test_dict.pop("variables", {}),
            config_variables
        )

        for key in test_dict["variables"]:
            parsed_key = parse_data(
                key,
                test_dict["variables"],
                functions,
                raise_if_variable_not_found=False
            )
            parsed_value = parse_data(
                test_dict["variables"][key],
                test_dict["variables"],
                functions,
                raise_if_variable_not_found=False
            )
            if parsed_key in test_dict["variables"]:
                test_dict["variables"][parsed_key] = parsed_value

        # parse test_dict name
        test_dict["name"] = parse_data(
            test_dict.pop("name", ""),
            test_dict["variables"],
            functions,
            raise_if_variable_not_found=False
        )

        if "testcase_def" in test_dict:
            # test_dict is nested testcase

            # 2, testcase test_dict => testcase_def config
            testcase_def = test_dict.pop("testcase_def")
            _extend_with_testcase(test_dict, testcase_def)

            # verify priority: nested testcase config > testcase config
            test_dict["config"].setdefault("verify", config_verify)

            # 3, testcase_def config => testcase_def test_dict
            _parse_testcase(test_dict, project_mapping)

        else:
            if "api_def" in test_dict:
                # test_dict has API reference
                # 2, test_dict => api
                api_def_dict = test_dict.pop("api_def")
                _extend_with_api(test_dict, api_def_dict)

            if test_dict.get("base_url"):
                # parse base_url
                base_url = parse_data(
                    test_dict.pop("base_url"),
                    test_dict["variables"],
                    functions
                )

                # build path with base_url
                # variable in current url maybe extracted from former api
                request_url = parse_data(
                    test_dict["request"]["url"],
                    test_dict["variables"],
                    functions,
                    raise_if_variable_not_found=False
                )
                test_dict["request"]["url"] = utils.build_url(
                    base_url,
                    request_url
                )

        # verify priority: testcase teststep > testcase config
        if "request" in test_dict and "verify" not in test_dict["request"]:
            test_dict["request"]["verify"] = config_verify
def __parse_testcase_tests ( tests , config , project_mapping ) : config_variables = config . get ( "variables" , { } ) config_base_url = config . pop ( "base_url" , "" ) config_verify = config . pop ( "verify" , False ) functions = project_mapping . get ( "functions" , { } ) for test_dict in tests : # base_url & verify: priority test_dict > config if ( not test_dict . get ( "base_url" ) ) and config_base_url : test_dict [ "base_url" ] = config_base_url # 1, testcase config => testcase tests # override test_dict variables test_dict [ "variables" ] = utils . extend_variables ( test_dict . pop ( "variables" , { } ) , config_variables ) for key in test_dict [ "variables" ] : parsed_key = parse_data ( key , test_dict [ "variables" ] , functions , raise_if_variable_not_found = False ) parsed_value = parse_data ( test_dict [ "variables" ] [ key ] , test_dict [ "variables" ] , functions , raise_if_variable_not_found = False ) if parsed_key in test_dict [ "variables" ] : test_dict [ "variables" ] [ parsed_key ] = parsed_value # parse test_dict name test_dict [ "name" ] = parse_data ( test_dict . pop ( "name" , "" ) , test_dict [ "variables" ] , functions , raise_if_variable_not_found = False ) if "testcase_def" in test_dict : # test_dict is nested testcase # 2, testcase test_dict => testcase_def config testcase_def = test_dict . pop ( "testcase_def" ) _extend_with_testcase ( test_dict , testcase_def ) # verify priority: nested testcase config > testcase config test_dict [ "config" ] . setdefault ( "verify" , config_verify ) # 3, testcase_def config => testcase_def test_dict _parse_testcase ( test_dict , project_mapping ) else : if "api_def" in test_dict : # test_dict has API reference # 2, test_dict => api api_def_dict = test_dict . pop ( "api_def" ) _extend_with_api ( test_dict , api_def_dict ) if test_dict . get ( "base_url" ) : # parse base_url base_url = parse_data ( test_dict . pop ( "base_url" ) , test_dict [ "variables" ] , functions ) # build path with base_url # variable in current url maybe extracted from former api request_url = parse_data ( test_dict [ "request" ] [ "url" ] , test_dict [ "variables" ] , functions , raise_if_variable_not_found = False ) test_dict [ "request" ] [ "url" ] = utils . build_url ( base_url , request_url ) # verify priority: testcase teststep > testcase config if "request" in test_dict and "verify" not in test_dict [ "request" ] : test_dict [ "request" ] [ "verify" ] = config_verify