I'm using ExecutionResult and ResultVisitor from robot.api to fetch the Testcase and keyword which causes the failure. But I'm not able to:
Print the reason for the failure. E.g., Suppose I've a failure something like this. I should be able to print the reason as Call not Found on Agent Desktop
Fetch the details from a keyword in the failed testcase. In my case, I should fetch the Arguments provided to a keyword and returned output from that keyword, which is part of the teardown.
*** Keywords ***
Teardown Keyword
[Arguments] ${arg1} ${arg2}
${output}= <Some execution here>
[return] ${output}
Here I should fetch the values of ${arg1}, ${arg2} and ${output}
This is my sample code for reference:
from robot.api import ExecutionResult, ResultVisitor
class Visitor(ResultVisitor):
def __init__(self):
self.failed = []
def end_test(self, test):
if test.status == "FAIL":
self.failed.append(test)
result = ExecutionResult('output.xml')
result.visit(visitor)
