mirror of
https://github.com/httprunner/httprunner.git
synced 2026-09-05 07:26:55 +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:
|
def __make_testsuite(testsuite: Dict) -> NoReturn:
|
||||||
"""convert valid testsuite dict to pytest folder with testcases"""
|
"""convert valid testsuite dict to pytest folder with testcases"""
|
||||||
try:
|
# validate testsuite format
|
||||||
# validate testcase format
|
load_testsuite(testsuite)
|
||||||
load_testsuite(testsuite)
|
|
||||||
except exceptions.TestSuiteFormatError as ex:
|
|
||||||
logger.error(f"TestSuiteFormatError: {ex}")
|
|
||||||
raise
|
|
||||||
|
|
||||||
config = testsuite["config"]
|
config = testsuite["config"]
|
||||||
testsuite_path = config["path"]
|
testsuite_path = config["path"]
|
||||||
|
|||||||
@@ -164,9 +164,12 @@ class ResponseObject(object):
|
|||||||
|
|
||||||
# check item
|
# check item
|
||||||
check_item = u_validator["check"]
|
check_item = u_validator["check"]
|
||||||
# TODO: validate variable or function
|
if "$" in check_item:
|
||||||
# check_item = parse_data(check_item, variables_mapping, functions_mapping)
|
# check_item is variable or function
|
||||||
check_value = jmespath.search(check_item, self.resp_obj_meta)
|
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)
|
check_value = parse_string_value(check_value)
|
||||||
|
|
||||||
# comparator
|
# comparator
|
||||||
|
|||||||
Reference in New Issue
Block a user