mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-07 07:21:23 +08:00
specify run times in testcase
This commit is contained in:
@@ -1 +1 @@
|
|||||||
__version__ = '0.2.2'
|
__version__ = '0.2.3'
|
||||||
@@ -61,6 +61,7 @@ class Runner(object):
|
|||||||
@param (dict) testcase
|
@param (dict) testcase
|
||||||
{
|
{
|
||||||
"name": "testcase description",
|
"name": "testcase description",
|
||||||
|
"times": 3,
|
||||||
"requires": [], # optional, override
|
"requires": [], # optional, override
|
||||||
"function_binds": {}, # optional, override
|
"function_binds": {}, # optional, override
|
||||||
"variable_binds": {}, # optional, override
|
"variable_binds": {}, # optional, override
|
||||||
@@ -89,16 +90,19 @@ class Runner(object):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
raise exception.ParamsError("URL or METHOD missed!")
|
raise exception.ParamsError("URL or METHOD missed!")
|
||||||
|
|
||||||
resp = self.http_client_session.request(url=url, method=method, **parsed_request)
|
run_times = int(testcase.get("times", 1))
|
||||||
resp_obj = response.ResponseObject(resp)
|
|
||||||
|
|
||||||
extract_binds = testcase.get("extract_binds", {})
|
extract_binds = testcase.get("extract_binds", {})
|
||||||
extracted_variables_mapping_list = resp_obj.extract_response(extract_binds)
|
|
||||||
self.context.bind_variables(extracted_variables_mapping_list, level="testset")
|
|
||||||
|
|
||||||
validators = testcase.get("validators", [])
|
validators = testcase.get("validators", [])
|
||||||
diff_content_list = resp_obj.validate(
|
|
||||||
validators, self.context.get_testcase_variables_mapping())
|
for _ in range(run_times):
|
||||||
|
resp = self.http_client_session.request(url=url, method=method, **parsed_request)
|
||||||
|
resp_obj = response.ResponseObject(resp)
|
||||||
|
|
||||||
|
extracted_variables_mapping_list = resp_obj.extract_response(extract_binds)
|
||||||
|
self.context.bind_variables(extracted_variables_mapping_list, level="testset")
|
||||||
|
|
||||||
|
diff_content_list = resp_obj.validate(
|
||||||
|
validators, self.context.get_testcase_variables_mapping())
|
||||||
|
|
||||||
return resp_obj.success, diff_content_list
|
return resp_obj.success, diff_content_list
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user