mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-12 11:29:48 +08:00
evaluate testcase name
This commit is contained in:
@@ -168,6 +168,11 @@ class Runner(object):
|
||||
|
||||
return True
|
||||
|
||||
def get_eval_content(self, content):
|
||||
""" evaluate content with variable bindings
|
||||
"""
|
||||
return self.context.testcase_parser.parse_content_with_bindings(content)
|
||||
|
||||
def extract_output(self, output_variables_list):
|
||||
""" extract output variables
|
||||
"""
|
||||
|
||||
@@ -72,10 +72,11 @@ class ApiTestSuite(unittest.TestSuite):
|
||||
|
||||
def _add_tests_to_suite(self, testcases):
|
||||
for testcase_dict in testcases:
|
||||
testcase_name = self.test_runner.get_eval_content(testcase_dict["name"])
|
||||
if utils.PYTHON_VERSION == 3:
|
||||
ApiTestCase.runTest.__doc__ = testcase_dict['name']
|
||||
ApiTestCase.runTest.__doc__ = testcase_name
|
||||
else:
|
||||
ApiTestCase.runTest.__func__.__doc__ = testcase_dict['name']
|
||||
ApiTestCase.runTest.__func__.__doc__ = testcase_name
|
||||
|
||||
test = ApiTestCase(self.test_runner, testcase_dict)
|
||||
[self.addTest(test) for _ in range(int(testcase_dict.get("times", 1)))]
|
||||
|
||||
Reference in New Issue
Block a user