mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-12 02:21:29 +08:00
feat: add exception SummaryEmpty
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
**Added**
|
||||
|
||||
- feat: store parse failed api/testcase/testsuite file path in `logs/xxx.parse_failed.json`
|
||||
- feat: add exception SummaryEmpty
|
||||
|
||||
**Fixed**
|
||||
|
||||
|
||||
@@ -74,3 +74,8 @@ class ApiNotFound(NotFoundError):
|
||||
|
||||
class TestcaseNotFound(NotFoundError):
|
||||
pass
|
||||
|
||||
|
||||
class SummaryEmpty(MyBaseError):
|
||||
""" test result summary data is empty
|
||||
"""
|
||||
|
||||
@@ -5,6 +5,7 @@ from datetime import datetime
|
||||
from jinja2 import Template
|
||||
|
||||
from httprunner import logger
|
||||
from httprunner.exceptions import SummaryEmpty
|
||||
|
||||
|
||||
def gen_html_report(summary, report_template=None, report_dir=None, report_file=None):
|
||||
@@ -17,6 +18,10 @@ def gen_html_report(summary, report_template=None, report_dir=None, report_file=
|
||||
report_file (str): specify html report file path, this has higher priority than specifying report dir.
|
||||
|
||||
"""
|
||||
if not summary["time"] or summary["stat"]["testcases"]["total"] == 0:
|
||||
logger.log_error("test result summary is empty ! {}".format(summary))
|
||||
raise SummaryEmpty
|
||||
|
||||
if not report_template:
|
||||
report_template = os.path.join(
|
||||
os.path.abspath(os.path.dirname(__file__)),
|
||||
|
||||
Reference in New Issue
Block a user