Skip to content

Instantly share code, notes, and snippets.

@adiralashiva8
Created January 28, 2019 16:01
Show Gist options
  • Save adiralashiva8/0f91bf0a3bfd194cfc32542e15cb377b to your computer and use it in GitHub Desktop.
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)
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