Created
January 28, 2019 16:10
-
-
Save adiralashiva8/c33d8a277b8e88ba6ce19ded0e1008bd to your computer and use it in GitHub Desktop.
Robotframework: Get test case metrics like test name, test status, 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 TestMetrics(ResultVisitor): | |
def visit_test(self,test): | |
print "Test Name: " + str(test.name) | |
print "Test Status: " + str(test.status) | |
print "Test Starttime: " + str(test.starttime) | |
print "Test Endtime: " + " " + str(test.endtime) | |
print "Test Elapsedtime (Sec): " + " " + str(test.elapsedtime/float(1000)) | |
result = ExecutionResult('output.xml') | |
result.configure(stat_config={'suite_stat_level': 2, | |
'tag_stat_combine': 'tagANDanother'}) | |
result.visit(TestMetrics()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How to get the value out from visit_test ?