Skip to content

Instantly share code, notes, and snippets.

@adiralashiva8
Last active September 11, 2019 09:52
Show Gist options
  • Save adiralashiva8/7c618172a157a6cec0790e8f28e55d9e to your computer and use it in GitHub Desktop.
Save adiralashiva8/7c618172a157a6cec0790e8f28e55d9e to your computer and use it in GitHub Desktop.
Robotframework: Get suite statistics by parsing output.xml using robot.result package (api)
from robot.api import ExecutionResult, ResultVisitor
total_suite = 0
passed_suite = 0
failed_suite = 0
class SuiteResults(ResultVisitor):
def start_suite(self,suite):
suite_test_list = suite.tests
if not suite_test_list:
pass
else:
global total_suite
total_suite += 1
if suite.status== "PASS":
global passed_suite
passed_suite += 1
else:
global failed_suite
failed_suite += 1
result = ExecutionResult("output.xml")
result.visit(SuiteResults())
print total_suite
print passed_suite
print failed_suite
@pasu-t
Copy link

pasu-t commented Sep 11, 2019

Nice

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