How can I add action when test fails?

Perhaps the below might help you, but as mentioned in the answers, there can be multiple reasons why a step might fail? I just read the Console log myself.