Created
January 28, 2019 16:01
-
-
Save adiralashiva8/0f91bf0a3bfd194cfc32542e15cb377b to your computer and use it in GitHub Desktop.
Robotframework: Get keyword 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_keywords = 0 | |
passed_keywords = 0 | |
failed_keywords = 0 | |
class KeywordResults(ResultVisitor): | |
def start_keyword(self,kw): | |
global total_keywords | |
total_keywords += 1 | |
if kw.status == "PASS": | |
global passed_keywords | |
passed_keywords += 1 | |
else: | |
global failed_keywords | |
failed_keywords += 1 | |
result = ExecutionResult("output.xml") | |
result.visit(KeywordResults()) | |
print total_keywords | |
print passed_keywords | |
print failed_keywords |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment