mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-20 15:50:47 +08:00
remove project_mapping from parse_tests result
This commit is contained in:
@@ -36,11 +36,11 @@ class HttpRunner(object):
|
||||
if log_file:
|
||||
logger.setup_logger(log_level, log_file)
|
||||
|
||||
def _add_tests(self, tests_mapping):
|
||||
def _add_tests(self, testcases):
|
||||
""" initialize testcase with Runner() and add to test suite.
|
||||
|
||||
Args:
|
||||
tests_mapping (dict): project info and testcases list.
|
||||
testcases (list): testcases list.
|
||||
|
||||
Returns:
|
||||
unittest.TestSuite()
|
||||
@@ -74,7 +74,7 @@ class HttpRunner(object):
|
||||
return test
|
||||
|
||||
test_suite = unittest.TestSuite()
|
||||
for testcase in tests_mapping["testcases"]:
|
||||
for testcase in testcases:
|
||||
config = testcase.get("config", {})
|
||||
test_runner = runner.Runner(config)
|
||||
TestSequense = type('TestSequense', (unittest.TestCase,), {})
|
||||
@@ -162,19 +162,20 @@ class HttpRunner(object):
|
||||
def run_tests(self, tests_mapping):
|
||||
""" run testcase/testsuite data
|
||||
"""
|
||||
project_mapping = tests_mapping.get("project_mapping", {})
|
||||
if self.save_tests:
|
||||
utils.dump_tests(tests_mapping, "loaded")
|
||||
utils.dump_logs(tests_mapping, project_mapping, "loaded")
|
||||
|
||||
# parse tests
|
||||
self.exception_stage = "parse tests"
|
||||
parsed_tests_mapping = parser.parse_tests(tests_mapping)
|
||||
parsed_testcases = parser.parse_tests(tests_mapping)
|
||||
|
||||
if self.save_tests:
|
||||
utils.dump_tests(parsed_tests_mapping, "parsed")
|
||||
utils.dump_logs(parsed_testcases, project_mapping, "parsed")
|
||||
|
||||
# add tests to test suite
|
||||
self.exception_stage = "add tests to test suite"
|
||||
test_suite = self._add_tests(parsed_tests_mapping)
|
||||
test_suite = self._add_tests(parsed_testcases)
|
||||
|
||||
# run test suite
|
||||
self.exception_stage = "run test suite"
|
||||
@@ -189,7 +190,7 @@ class HttpRunner(object):
|
||||
report.stringify_summary(self._summary)
|
||||
|
||||
if self.save_tests:
|
||||
utils.dump_summary(self._summary, tests_mapping["project_mapping"])
|
||||
utils.dump_logs(self._summary, project_mapping, "summary")
|
||||
|
||||
report_path = report.render_html_report(
|
||||
self._summary,
|
||||
@@ -289,11 +290,11 @@ def prepare_locust_tests(path):
|
||||
|
||||
"""
|
||||
tests_mapping = loader.load_tests(path)
|
||||
parsed_tests_mapping = parser.parse_tests(tests_mapping)
|
||||
testcases = parser.parse_tests(tests_mapping)
|
||||
|
||||
locust_tests = []
|
||||
|
||||
for testcase in parsed_tests_mapping["testcases"]:
|
||||
for testcase in testcases:
|
||||
testcase_weight = testcase.get("config", {}).pop("weight", 1)
|
||||
for _ in range(testcase_weight):
|
||||
locust_tests.append(testcase)
|
||||
|
||||
Reference in New Issue
Block a user