In order to optimize time of execution, i create some test cases dependent from each other i want to get metrics and statistics not only for each testcase and testsuite. But also i want to generate statistics and metrics for each step. Is that possible ? PS : I'm using team city for continuous integration.
Best regards,
Emna A.
Using robot framework api we can get TEST and KEYWORD Metrics
Reference:
API:
Keyword Metrics Code:
# Keyword Metrics Code: (save following snippet as python file and execute)
from robot.api import ExecutionResult,ResultVisitor
result = ExecutionResult('output.xml')
result.configure(stat_config={'suite_stat_level': 2,
'tag_stat_combine': 'tagANDanother'})
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.visit(KeywordMetrics())
# Note:
# visit_keyword() returns userdefined keywords
# start_keyword() returns all the keywords (library and user defined)
Test Metrics Code:
# Test Metrics Code: (save following snippet as python file and execute)
from robot.api import ExecutionResult,ResultVisitor
result = ExecutionResult('output.xml')
result.configure(stat_config={'suite_stat_level': 2,
'tag_stat_combine': 'tagANDanother'})
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.visit(TestMetrics())
Robot framework Metrics project is implemented to show metrics result in HTML format with dashboard view.
Highlights