call print_output after each testset

This commit is contained in:
debugtalk
2018-07-19 15:27:00 +08:00
parent 95db6f22dd
commit baaca1290f
2 changed files with 6 additions and 6 deletions

View File

@@ -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():

View File

@@ -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