Forum Discussion

TestOfficer's avatar
TestOfficer
Occasional Contributor
6 years ago

Stop TestComplete execution if application under test crashes

Hi SmartBear Community,

 

I think my question is very simple but not so easy to understand.
If the application under test crashes, TestComplete should either stop the test completely or switch to the next test item.
The situation is as follows:
1. the application under test is started
2. several things are done in the application
3. an error occurs suddenly and the application is completely closed without any error message or other hints and the process is terminated. I.e. it no longer exists in the Windows system.
The problem is now, that TestComplete doesn't notice any of this and the test execution simply continues.

This means that one error comes after the other.
In this case, however, the test execution should simply be stopped.
Please do not send me the link with the SmartBear Support page where the topic "Tracing Exceptions, Crashes and Freezes" is covered. This doesn't help in case of a crash! Also in case of a crash the LogOnError event is not triggered.

To add a check in several places in KeywordTests/Scripts would be a solution I would like to avoid!
Is it still technically possible to do this in TestComplete?

 

best regards and many thanks

Klaus

  • While the application crash is not detected, I'm assuming that there are other errors that occur after the crash, usually object identification errors of sorts.

     

    I would still suggest using OnLogError event handler.  What you could do is, in that event handler, add a check for if (!Sys.WaitProcess('myapp').Exists) then to detect if the process is present.  If it is not, you can call Runner.Stop() and kill the whole test run.

    An alternative: In TestComplete 14, under Tools -> Current Project Properties -> Playback there's an On object recognition error setting that you can set to Stop Project which will halt the whole run if an object recognition error occurs. 

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    While the application crash is not detected, I'm assuming that there are other errors that occur after the crash, usually object identification errors of sorts.

     

    I would still suggest using OnLogError event handler.  What you could do is, in that event handler, add a check for if (!Sys.WaitProcess('myapp').Exists) then to detect if the process is present.  If it is not, you can call Runner.Stop() and kill the whole test run.

    An alternative: In TestComplete 14, under Tools -> Current Project Properties -> Playback there's an On object recognition error setting that you can set to Stop Project which will halt the whole run if an object recognition error occurs. 

    • TestOfficer's avatar
      TestOfficer
      Occasional Contributor

      Thank you very much for that detailed answer!