How to execute steps or script when test steps fails?
I want to do some steps like "click [Enter]" to the web page / browser when the test item is failed.
Then keep run the rest test items
Is this workable?
Solved! Go to Solution.
Beyond the event handlers that @rraghvani suggests, you could also go the route of using try/catch/finally code. This is available both in keyword tests and in script code (depending upon your script language). This will allow you to execute code on exceptions as well as a "finally" block to execute at the end of every test case.
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
Why automate? I do automated testing because there's only so much a human being can do and remain healthy. Sleep is a requirement. So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.
Mysterious Gremlin Master
Vegas Thrill Rider
Just a note to make sure you understand the difference between OnLogError event suggested by @rraghvani and try/catch/finally code mentioned by @tristaanogre :
-- OnLogError will handle 'logical' script problems, for example, the click on the object that has zero size;
-- try/catch/finally will handle runtime exceptions, like an attempt to use null object or divide by zero.
/Alex [Community Hero]
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.