Forum Discussion

Ryan_Petty's avatar
Ryan_Petty
New Contributor
14 years ago

Error handling non-modal windows

I am new to Test Complete and am testing a .NET application. I do not have programming capabilities and I am trying to figure out how to catch exceptions in our .NET application. Many of our errors are non-modal. I am using checkpoints in Test Complete to check to see if an object exists or is visible to ensure the operation completed successfully.



However, sometimes part of an operation will complete and that object in the checkpoint will still exist, but an error message will also pop up in a small portion of the screen. It's non-modal so it doesn't prevent further actions from being performed on any part of the window except the small part that it overlaps. The problem is Test Complete says the test completed successfully. I want to be able to detect that exception window that pops up however and log it.



I have searched quite a bit through the forums and documentation and I see the On Overlapping Window event as well as the On Unexpected Error event. I have seen people ask if they can tell Test Complete what an unexpected window is and I couldn't see a clear answer to that. I have turned on to stop tests if the On Unexpected Error event occurs but our program's exception does not trigger that event. The On Overlapping Window event seems to only be called if a window pops up on the screen on top of a button or object to click, but our exception window is small and the odds that it will be over an area we are clicking is minimal.



I am no programmer, but I can reproduce the exception in our software and it does seem we have a standard exception window/object that pops up in our software that contains the actual error. It is a WinFormsObject called "ExceptionDialog". The actual error text within this object varies when the error comes up, but the "ExceptionDialog" seems standard.



So it's essentially the same object that I want to check to see if it pops up during a test and if it does, log some of the text properties of that object and log it as an error like Unexpected Window gets logged as. Sorry if there's a simple solution to this, but I could not find one. If it takes some coding, it's possible I can get some help from our developers soon, but would like to know my options.
  • Ryan_Petty's avatar
    Ryan_Petty
    New Contributor
    I have learned to do property checkpoints on objects to check to see if an object's "Exists" property is set to true (or use other properties, such as visible), and I tried to use a property checkpoint to see if the "ExceptionDialog" 'Exists' property is set to False, but this causes the test to fail each time the "ExceptionDialog" object does not occur because TestComplete says it can't verify the property of an object that is not present. That makes sense, a dialog's "Exists" property would likely always be true if the object actually exists, otherwise it wouldn't exist and you can't verify a property of it. 



    Anyone have any suggestions?