I need to capture screenshots when tests fail without using the "run keyword if tests fail" keyword in the teardown. Right now, I'm trying to add:
if attributes['type'] == 'TEARDOWN':
test = BuiltIn()._get_test_in_teardown('Run Keyword If Test Failed')
if test.failed:
screenshot_file = BuiltIn().run_keyword('AppiumLibrary.Capture page screenshot')
BuiltIn().run_keyword('Send attachment to report portal', screenshot_file)
to start_keyword method of reportportal.listener but it cannot work.
The Send attachment to report portal is from report portal send attachment document.
My expectation is to capture screenshot and send an attachment to report portal by using listener.