Created
January 28, 2019 16:12
-
-
Save adiralashiva8/c6a524c554da8e2b414fe6342d50785f to your computer and use it in GitHub Desktop.
Robotframework: Get keyword metrics like keyword name, keyword status, total keywords, keywords 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 KeywordMetrics(ResultVisitor): | |
def visit_keyword(self,kw): | |
print "Keyword Name: " + str(kw.name) | |
print "Keyword Status: " + str(kw.status) | |
print "Keyword Starttime: " + str(kw.starttime) | |
print "Keyword Endtime: " + " " + str(kw.endtime) | |
print "Keyword Elapsedtime (Sec): " + " " + str(kw.elapsedtime/float(1000)) | |
result = ExecutionResult('output.xml') | |
result.configure(stat_config={'suite_stat_level': 2, | |
'tag_stat_combine': 'tagANDanother'}) | |
result.visit(KeywordMetrics()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment