Why except block won't executed when an error occurs within try block?
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Why except block won't executed when an error occurs within try block?
I am testing window application, and use try...except...finally to catch errors during run script test. But now it won't execute except block when an error occurs within try block, please refer to attached scripts and screenshot for more details.
Solved! Go to Solution.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
As far as i know, This expected behavior only. The errors coming from test are not actually a exception hence it will not throw a run-time error.
Some of the errors are not part of RunTime error
- Object Not Found
- Unable to Recognize the Image on the Current Desktop
- Search for a Mapped Object Took Too Much Time
- The test run has stopped because the Stop on Error (Warning) setting is enabled
- Incomplete Keyboard Input
- There was an attempt to perform an action at point...
- The window is invisible and thus cannot be activated
- and more..
Basically, Python or any other language can't capture some of the Test Complete Playback errors.
More details: https://support.smartbear.com/testcomplete/docs/testing-with/running/handling-errors/index.html
Some related topics:
Thanks
Shankar R
LinkedIn | CG-VAK Software | Bitbucket | shankarr.75@gmail.com
“You must expect great things from you, before you can do them”- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What @shankar_r says is accurate. try/except logic, regardless of the language, will only trap actual runtime code exceptions. Errors logged due to object identification errors as listed or any other errors logged via TestComplete do not throw an exception.
If you want a particular error to throw an exception, you'll have to use the associated "throw" or "raise" command according to your code language.
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
