I want to get status of each keyword execution. e.g. when click action performed whether that is successful or not and if that failed then I want to call some other api by passing failed status to that api.
Is there any way in robot framework which we can add as a listener for each keyword and which will return us status as success/fail for each keyword.
Or is there any way , by which we can get status of keyword dynamically. Because we never know when our test case is going to fail.
Or how we ca add try-catch in keyword so that when execution will go in catch I will call my api by passing status as fail.
Yes @aaltat
I did not understand how we can capture failed status. Currently if keyword is failed due to functional issue or syntax issue, its failing correctly.
But I want to check status at the end every keyword execution whether prior steps within that keyword is passed or failed?
I read the PythonListener: part as well from that guide. But did not get how those will be called.
Yes I added Python Listener as below
def end_test(name, attrs):
if attrs[‘status’] == ‘FAIL’:
print(‘Test “%s” failed: %s’ % (name, attrs[‘message’]))
input(‘Press enter to continue.’)
Then referred as library in robot file but it is not giving me status of keyword
Library listeners don’t get notifications from keyword level ,only about suite level events. You need change your code as a listener. See in Robot Framework User Guide
@aaltat
Can you please help me to understand this simple scenario as I am new to robot framework-
I have robot script which has 4 steps-
open browser
Login using correct credentials
Upload file
Check table content
If any of the above keyword step failed, I want to capture status at either keyword level or Suite Teardown level so that I can utilize that status to call my rest request further.