Forum Discussion

North-E's avatar
North-E
Occasional Contributor
15 years ago

Handling exceptions in different units

Hi, everyone!



I'm new in testing, so need your advice about running script tests for my Visual Studio C++ application in TestComplete 7 (JScript language is used).

I have main script unit called "Testing" where test routines are placed. All manipulations with application's interface are discribed by functions in other units which included in "Testing" by //USEUNIT...

I created few test items and then ran the project. During project execution the application may crash, and then script stops with an exception or/and error. These exceptions occur in other script units. I tried to catch them using "try...catch" construnction in "Testing" but it doesn't work. Therefore, TestComplete project stops with following message: "The following error occured while the element specified in the "Test-case #0002" test item was being executed. Do you want to stop the project execution?". I had to say "No" manually everytime I wanted to continue testing by next test item. But how can I catch all exceptions in one place to avoid TestComplete questions and continue project run automatically?

I tried to set "Stop on exception" and "Stop on error" for test items but these options are not suitable in this case.

Sometimes I also receive "Visual Studio++ Runtime Error" window when the application crashes. And seemed to me, this is not unexpected window or I still don't know how to handle it (project's playback options for unexpected windows are "Click on focused control" and below).



Thanks a lot for attention. Hope for your answers. Any advice will be useful...

22 Replies