Created
January 28, 2019 16:08
-
-
Save adiralashiva8/4b679df1af0aa8ce539d101c066575ee to your computer and use it in GitHub Desktop.
Robotframework: Get suite metrics like suite name, suite status, total tests in suite, suite duration by parsing output.xml using robot.result package (api)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from robot.api import ExecutionResult, ResultVisitor | |
class SuiteResults(ResultVisitor): | |
def start_suite(self, suite): | |
suite_test_list = suite.tests | |
if not suite_test_list: | |
pass | |
else: | |
stats = suite.statistics | |
print "Suite name:",suite | |
print "Suite status:",suite.status | |
print "Total tests in suite:",stats.all.total | |
print "Passed tests in suite:",stats.all.passed | |
print "Failed tests in suite:",stats.all.failed | |
print "Suite start time:",suite.starttime | |
print "Suite end time:",suite.endtime | |
print "Suite duration(s):",suite.elapsedtime/float(1000) | |
result = ExecutionResult("output.xml") | |
result.visit(SuiteResults()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment