aboutsummaryrefslogtreecommitdiffstats
path: root/xtesting/core
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2018-08-07 07:16:57 +0200
committerCédric Ollivier <cedric.ollivier@orange.com>2018-08-07 09:29:02 +0200
commitb7f4eaa213b65a266f527d9def7679eac7e0353b (patch)
tree2a899ef2d7ef1444dc6beccfb2f22611167b33c8 /xtesting/core
parent0b69c9ee6ca5188045a5927b41fa2666555631d9 (diff)
Generate robot reports
Change-Id: Ib9efe14bce6227f9609200c12ded4470bd0be969 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
Diffstat (limited to 'xtesting/core')
-rw-r--r--xtesting/core/robotframework.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/xtesting/core/robotframework.py b/xtesting/core/robotframework.py
index 007b9629..4cba7bbb 100644
--- a/xtesting/core/robotframework.py
+++ b/xtesting/core/robotframework.py
@@ -17,6 +17,7 @@ import os
import robot.api
from robot.errors import RobotError
+from robot.reporting import resultwriter
import robot.run
from robot.utils.robottime import timestamp_to_secs
from six import StringIO
@@ -77,6 +78,15 @@ class RobotFramework(testcase.TestCase):
self.details['description'] = result.suite.name
self.details['tests'] = visitor.get_data()
+ def generate_report(self):
+ """Generate html and xunit outputs"""
+ result = robot.api.ExecutionResult(self.xml_file)
+ writer = resultwriter.ResultWriter(result)
+ return writer.write_results(
+ report='{}/report.html'.format(self.res_dir),
+ log='{}/log.html'.format(self.res_dir),
+ xunit='{}/xunit.xml'.format(self.res_dir))
+
def run(self, **kwargs):
"""Run the RobotFramework suites
@@ -113,11 +123,12 @@ class RobotFramework(testcase.TestCase):
robot.run(*suites, variable=variable, variablefile=variablefile,
include=include, output=self.xml_file, log='NONE',
report='NONE', stdout=stream)
- self.__logger.info("\n" + stream.getvalue())
- self.__logger.info("Results were successfully generated")
+ self.__logger.info("\n%s", stream.getvalue())
try:
self.parse_results()
self.__logger.info("Results were successfully parsed")
+ assert self.generate_report() == 0
+ self.__logger.info("Results were successfully generated")
except RobotError as ex:
self.__logger.error("Run suites before publishing: %s", ex.message)
return self.EX_RUN_ERROR