bind_extractors: Bind named extractors to value within the context.

This commit is contained in:
httprunner
2017-06-28 21:38:43 +08:00
parent fc9218c70c
commit 6438fe653a
2 changed files with 19 additions and 0 deletions

View File

@@ -41,6 +41,9 @@ class TestRunner(object):
variable_binds = config_dict.get('variable_binds', [])
self.context.bind_variables(variable_binds)
extract_binds = config_dict.get('extract_binds', {})
self.context.bind_extractors(extract_binds)
self.testcase_parser.update_variables_binds(self.context.variables)
def parse_testcase(self, testcase):
@@ -101,6 +104,7 @@ class TestRunner(object):
raise exception.ParamsError("URL or METHOD missed!")
resp_obj = self.client.request(url=url, method=method, **req_kwargs)
response.extract_response(resp_obj, self.context)
diff_content = response.diff_response(resp_obj, testcase['response'])
success = False if diff_content else True
return success, diff_content