refactor lib function interface

This commit is contained in:
debugtalk
2018-04-17 16:37:41 +08:00
parent 9d3c5c5ef7
commit b6450afd0b
6 changed files with 137 additions and 139 deletions

View File

@@ -26,6 +26,9 @@ def main_hrun():
parser.add_argument(
'testset_paths', nargs='*',
help="testset file path")
parser.add_argument(
'--no-html-report', action='store_true', default=False,
help="do not generate html report.")
parser.add_argument(
'--html-report-name',
help="specify html report name, only effective when generating html report.")
@@ -78,13 +81,17 @@ def main_hrun():
create_scaffold(project_path)
exit(0)
result = HttpRunner(args.testset_paths, failfast=args.failfast).run(
html_report_name=args.html_report_name,
html_report_template=args.html_report_template
)
runner = HttpRunner(failfast=args.failfast).run(args.testset_paths)
print_output(result["output"])
return 0 if result["success"] else 1
if not args.no_html_report:
runner.gen_html_report(
html_report_name=args.html_report_name,
html_report_template=args.html_report_template
)
summary = runner.summary
print_output(summary["output"])
return 0 if summary["success"] else 1
def main_locust():
""" Performance test with locust: parse command line options and run commands.