mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-12 02:21:29 +08:00
fix: validate field with variable or function
This commit is contained in:
@@ -184,12 +184,8 @@ def __make_testcase(testcase: Dict, dir_path: Text = None) -> NoReturn:
|
||||
|
||||
def __make_testsuite(testsuite: Dict) -> NoReturn:
|
||||
"""convert valid testsuite dict to pytest folder with testcases"""
|
||||
try:
|
||||
# validate testcase format
|
||||
load_testsuite(testsuite)
|
||||
except exceptions.TestSuiteFormatError as ex:
|
||||
logger.error(f"TestSuiteFormatError: {ex}")
|
||||
raise
|
||||
# validate testsuite format
|
||||
load_testsuite(testsuite)
|
||||
|
||||
config = testsuite["config"]
|
||||
testsuite_path = config["path"]
|
||||
|
||||
@@ -164,9 +164,12 @@ class ResponseObject(object):
|
||||
|
||||
# check item
|
||||
check_item = u_validator["check"]
|
||||
# TODO: validate variable or function
|
||||
# check_item = parse_data(check_item, variables_mapping, functions_mapping)
|
||||
check_value = jmespath.search(check_item, self.resp_obj_meta)
|
||||
if "$" in check_item:
|
||||
# check_item is variable or function
|
||||
check_value = parse_data(check_item, variables_mapping, functions_mapping)
|
||||
else:
|
||||
check_value = jmespath.search(check_item, self.resp_obj_meta)
|
||||
|
||||
check_value = parse_string_value(check_value)
|
||||
|
||||
# comparator
|
||||
|
||||
Reference in New Issue
Block a user