diff --git a/httprunner/cli.py b/httprunner/cli.py index a9192021..fdabd9a7 100644 --- a/httprunner/cli.py +++ b/httprunner/cli.py @@ -11,8 +11,7 @@ from httprunner.__about__ import __description__, __version__ from httprunner.compat import is_py2 from httprunner.task import HttpRunner from httprunner.utils import (create_scaffold, get_python2_retire_msg, - prettify_json_file, print_output, - validate_json_file) + prettify_json_file, validate_json_file) def main_hrun(): @@ -88,9 +87,6 @@ def main_hrun(): ) summary = runner.summary - for suite_summary in summary["details"]: - print_output(suite_summary["output"]) - return 0 if summary["success"] else 1 def main_locust(): diff --git a/httprunner/task.py b/httprunner/task.py index 1f02fde2..76f28fa0 100644 --- a/httprunner/task.py +++ b/httprunner/task.py @@ -9,7 +9,7 @@ from httprunner.compat import is_py3 from httprunner.report import (HtmlTestResult, get_platform, get_summary, render_html_report) from httprunner.testcase import TestcaseLoader -from httprunner.utils import load_dot_env_file +from httprunner.utils import load_dot_env_file, print_output class TestCase(unittest.TestCase): @@ -259,12 +259,16 @@ class HttpRunner(object): for test_suite in test_suite_list: result = self.runner.run(test_suite) test_suite_summary = get_summary(result) + self.summary["success"] &= test_suite_summary["success"] test_suite_summary["name"] = test_suite.config.get("name") test_suite_summary["base_url"] = test_suite.config.get("request", {}).get("base_url", "") test_suite_summary["output"] = test_suite.output + print_output(test_suite_summary["output"]) + accumulate_stat(self.summary["stat"], test_suite_summary["stat"]) accumulate_stat(self.summary["time"], test_suite_summary["time"]) + self.summary["details"].append(test_suite_summary) return self