(path)
return loaded_content
load test file, file maybe testcase/testsuite/api

    Args:
        path (str): test file path

    Returns:
        dict: loaded test content

            # api
            {
                "path": path,
                "type": "api",
                "name": "",
                "request": {}
            }

            # testcase
            {
                "path": path,
                "type": "testcase",
                "config": {},
                "teststeps": []
            }

            # testsuite
            {
                "path": path,
                "type": "testsuite",
                "config": {},
                "testcases": {}
            }
load test file, file maybe testcase/testsuite/api
load test file file maybe testcase / testsuite / api
def load_test_file(path):
    """ load test file, file maybe testcase/testsuite/api

    Args:
        path (str): test file path

    Returns:
        dict: loaded test content

            # api
            {
                "path": path,
                "type": "api",
                "name": "",
                "request": {}
            }

            # testcase
            {
                "path": path,
                "type": "testcase",
                "config": {},
                "teststeps": []
            }

            # testsuite
            {
                "path": path,
                "type": "testsuite",
                "config": {},
                "testcases": {}
            }

    """
    raw_content = load_file(path)
    loaded_content = None

    if isinstance(raw_content, dict):

        if "testcases" in raw_content:
            # file_type: testsuite
            # TODO: add json schema validation for testsuite
            loaded_content = load_testsuite(raw_content)
            loaded_content["path"] = path
            loaded_content["type"] = "testsuite"
        elif "request" in raw_content:
            # file_type: api
            # TODO: add json schema validation for api
            loaded_content = raw_content
            loaded_content["path"] = path
            loaded_content["type"] = "api"
        else:
            # invalid format
            logger.log_warning("Invalid test file format: {}".format(path))

    elif isinstance(raw_content, list) and len(raw_content) > 0:
        # file_type: testcase
        # TODO: add json schema validation for testcase
        loaded_content = load_testcase(raw_content)
        loaded_content["path"] = path
        loaded_content["type"] = "testcase"

    else:
        # invalid format
        logger.log_warning("Invalid test file format: {}".format(path))

    return loaded_content
def load_test_file ( path ) : raw_content = load_file ( path ) loaded_content = None if isinstance ( raw_content , dict ) : if "testcases" in raw_content : # file_type: testsuite # TODO: add json schema validation for testsuite loaded_content = load_testsuite ( raw_content ) loaded_content [ "path" ] = path loaded_content [ "type" ] = "testsuite" elif "request" in raw_content : # file_type: api # TODO: add json schema validation for api loaded_content = raw_content loaded_content [ "path" ] = path loaded_content [ "type" ] = "api" else : # invalid format logger . log_warning ( "Invalid test file format: {}" . format ( path ) ) elif isinstance ( raw_content , list ) and len ( raw_content ) > 0 : # file_type: testcase # TODO: add json schema validation for testcase loaded_content = load_testcase ( raw_content ) loaded_content [ "path" ] = path loaded_content [ "type" ] = "testcase" else : # invalid format logger . log_warning ( "Invalid test file format: {}" . format ( path ) ) return loaded_content