Want do action when case failed

hi all:
i use robotfrmework for tesing . i have test scenario that when case failed . i want backup my test data. anyone have good method. due to i have too many test case. does there have good metod to cover all tes

Hi Davie,

Can you give us some background to how you are running your tests and the reason for your question?

Robot Framework’s logs remain on the machine after the robot process finishes or exits, so the answer could be as simple as getting the return code from robot and then based on a non zero return code copy the files from the test machine to some other location.

Another option could be to have a listener for end_suite to do the actions in python code but the problem with this is the file may not be complete if you copy them at this point so I think it may be better to copy logs after robot exits.

Hope that helps,


I would suggest you to put a condition in Test Teardown. Of course you gonna need a keyword to do the backup for you. So every time a test case fails, it’ll run that backup keyword.

Test Teardown
    Run Keyword If Test Failed  Database Backup