mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-06 23:11:21 +08:00
add validation: run method should be called before gen_html_report.
This commit is contained in:
@@ -38,6 +38,7 @@ class HttpRunner(object):
|
|||||||
kwargs.setdefault("resultclass", report.HtmlTestResult)
|
kwargs.setdefault("resultclass", report.HtmlTestResult)
|
||||||
self.unittest_runner = unittest.TextTestRunner(**kwargs)
|
self.unittest_runner = unittest.TextTestRunner(**kwargs)
|
||||||
self.test_loader = unittest.TestLoader()
|
self.test_loader = unittest.TestLoader()
|
||||||
|
self.summary = None
|
||||||
|
|
||||||
def _add_tests(self, testcases):
|
def _add_tests(self, testcases):
|
||||||
""" initialize testcase with Runner() and add to test suite.
|
""" initialize testcase with Runner() and add to test suite.
|
||||||
@@ -245,6 +246,9 @@ class HttpRunner(object):
|
|||||||
str: generated html report path
|
str: generated html report path
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
if not self.summary:
|
||||||
|
raise exceptions.MyBaseError("run method should be called before gen_html_report.")
|
||||||
|
|
||||||
self.exception_stage = "generate report"
|
self.exception_stage = "generate report"
|
||||||
return report.render_html_report(
|
return report.render_html_report(
|
||||||
self.summary,
|
self.summary,
|
||||||
|
|||||||
Reference in New Issue
Block a user