Reputation: 35
Im using python 2.7.15 with robot versuon 3.0.4. I have a requirement to take only the screenshots of FAILED test cases. Some posts in stackoverflow says listeners must be used for manipulating test results. or is there a keyword for the same?
Upvotes: 0
Views: 1539
Reputation: 833
Not sure what you're after but this is what I use at RF level:
Global Test Teardown
Run Keyword If Test Failed Capture Page Screenshot
Alternatively you should be able to do something like this in Python:
def global_test_teardown(testStatus=BuiltIn().get_variable_value("${TEST STATUS}")):
seleniumlib = BuiltIn().get_library_instance('SeleniumLibrary')
if testStatus=="FAIL":
seleniumlib.capture_page_screenshot()
Upvotes: 1