mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-12 16:01:27 +08:00
feat: add exception SummaryEmpty
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
**Added**
|
**Added**
|
||||||
|
|
||||||
- feat: store parse failed api/testcase/testsuite file path in `logs/xxx.parse_failed.json`
|
- feat: store parse failed api/testcase/testsuite file path in `logs/xxx.parse_failed.json`
|
||||||
|
- feat: add exception SummaryEmpty
|
||||||
|
|
||||||
**Fixed**
|
**Fixed**
|
||||||
|
|
||||||
|
|||||||
@@ -74,3 +74,8 @@ class ApiNotFound(NotFoundError):
|
|||||||
|
|
||||||
class TestcaseNotFound(NotFoundError):
|
class TestcaseNotFound(NotFoundError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class SummaryEmpty(MyBaseError):
|
||||||
|
""" test result summary data is empty
|
||||||
|
"""
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ from datetime import datetime
|
|||||||
from jinja2 import Template
|
from jinja2 import Template
|
||||||
|
|
||||||
from httprunner import logger
|
from httprunner import logger
|
||||||
|
from httprunner.exceptions import SummaryEmpty
|
||||||
|
|
||||||
|
|
||||||
def gen_html_report(summary, report_template=None, report_dir=None, report_file=None):
|
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.
|
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:
|
if not report_template:
|
||||||
report_template = os.path.join(
|
report_template = os.path.join(
|
||||||
os.path.abspath(os.path.dirname(__file__)),
|
os.path.abspath(os.path.dirname(__file__)),
|
||||||
|
|||||||
Reference in New Issue
Block a user