Skip to content

Instantly share code, notes, and snippets.

@adiralashiva8
Created January 28, 2019 16:10
Show Gist options
  • Save adiralashiva8/c33d8a277b8e88ba6ce19ded0e1008bd to your computer and use it in GitHub Desktop.
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)
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())
@iShekhar
Copy link

How to get the value out from visit_test ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment