Ask a Question

Run script on fail


Run script on fail

Hello everyone,


does anyone know how to make TestComplete run specified script (e.g. app termination) if testcase fails. Thank you in advance!





Esteemed Contributor

There are many ways to do this, depending upon your configuration... probably the most "obvious" is to utilize an event handler.  There are several available in TestComplete including, but not limited to, "OnStopTest", "OnLogError", and "OnLogWarning".  Do a search of the online help documentation to understand how to implement these.


Additionally, within your automation, you could implement "try/catch/finally" logic to detect fail points and, when something errors out, handle the situation in the "finally" block of code.


There are probably other ways of doing this, but these are the two that are probably the most common ways of solving this problem.


If you need specific help in implementing these, please let us know and we'll see what we can do.

Robert Martin
[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
Extensions available
Showing results for 
Search instead for 
Did you mean: