Last active
September 11, 2019 09:52
-
-
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)
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 | |
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice