mirror of
https://github.com/httprunner/httprunner.git
synced 2026-08-28 19:47:14 +08:00
rename variable name, avoid confliction with module name
This commit is contained in:
+13
-13
@@ -66,9 +66,9 @@ class Runner(object):
|
|||||||
|
|
||||||
return parsed_request
|
return parsed_request
|
||||||
|
|
||||||
def _run_test(self, testcase):
|
def _run_test(self, testcase_dict):
|
||||||
""" run single testcase.
|
""" run single testcase.
|
||||||
@param (dict) testcase
|
@param (dict) testcase_dict
|
||||||
{
|
{
|
||||||
"name": "testcase description",
|
"name": "testcase description",
|
||||||
"times": 3,
|
"times": 3,
|
||||||
@@ -92,7 +92,7 @@ class Runner(object):
|
|||||||
}
|
}
|
||||||
@return True or raise exception during test
|
@return True or raise exception during test
|
||||||
"""
|
"""
|
||||||
parsed_request = self.init_config(testcase, level="testcase")
|
parsed_request = self.init_config(testcase_dict, level="testcase")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
url = parsed_request.pop('url')
|
url = parsed_request.pop('url')
|
||||||
@@ -101,14 +101,14 @@ class Runner(object):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
raise exception.ParamsError("URL or METHOD missed!")
|
raise exception.ParamsError("URL or METHOD missed!")
|
||||||
|
|
||||||
run_times = int(testcase.get("times", 1))
|
run_times = int(testcase_dict.get("times", 1))
|
||||||
extractors = testcase.get("extract") \
|
extractors = testcase_dict.get("extract") \
|
||||||
or testcase.get("extractors") \
|
or testcase_dict.get("extractors") \
|
||||||
or testcase.get("extract_binds", [])
|
or testcase_dict.get("extract_binds", [])
|
||||||
validators = testcase.get("validate") \
|
validators = testcase_dict.get("validate") \
|
||||||
or testcase.get("validators", [])
|
or testcase_dict.get("validators", [])
|
||||||
setup_actions = testcase.get("setup", [])
|
setup_actions = testcase_dict.get("setup", [])
|
||||||
teardown_actions = testcase.get("teardown", [])
|
teardown_actions = testcase_dict.get("teardown", [])
|
||||||
|
|
||||||
def setup_teardown(actions):
|
def setup_teardown(actions):
|
||||||
for action in actions:
|
for action in actions:
|
||||||
@@ -182,9 +182,9 @@ class Runner(object):
|
|||||||
|
|
||||||
self.init_config(config_dict, level="testset")
|
self.init_config(config_dict, level="testset")
|
||||||
testcases = testset.get("testcases", [])
|
testcases = testset.get("testcases", [])
|
||||||
for testcase in testcases:
|
for testcase_dict in testcases:
|
||||||
try:
|
try:
|
||||||
assert self._run_test(testcase)
|
assert self._run_test(testcase_dict)
|
||||||
except AssertionError:
|
except AssertionError:
|
||||||
success = False
|
success = False
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user