We are building a new experience for our SmartBear Community.
This site is now read-only. You can still browse and search as usual. Learn More
This site is now read-only. You can still browse and search as usual. Learn More
I am testing WPF application. And i have configured a UnexpectedWindow event via Events--> EventControl. The Event is fired only for the first time an unexpected window appears.
For the subsequent unexpected windows, The Event is not fired
For reference, The Sequence is as follows:
1.) some test steps
2.) unwanted dialog appears -> event fired and handled properly
3.) some test steps
4.) unwanted window appears -> no events fired, timeout and error.
am i missing something ? should configure something so that event is fired every time ?
TestComplete Version: 15.80.1.7 x64
In TestComplete this usually happens for one of these reasons:
Most commonly (especially with WPF apps), the dialog isn’t actually being recreated the second time — it’s just being hidden and shown again. If the window object never gets destroyed, TestComplete doesn’t treat it as a “new” unexpected window, so the event won’t fire again. You can confirm this in Object Browser by checking whether the window truly disappears from the hierarchy or just toggles Visible, rather than being removed completely.
Other things worth checking:
If this resolves your scenario, marking it as the solution helps future readers find it quickly.
Hello Hassan Ballan,
Thanks for the response. I have checked and tried all the options you have mentined. I came here after exchauting all the options i have.
But today when i changed to this option, The UnexpectedWindow event seems to be fired all the time.
Tools-->Current Project Properties--> On error: Stop and rerun current item
Not sure why it happens. But Intuitively speaking, even when this Option is set to "Stop project/Stop current item", the event should be triggered.
I will keep you posted if there are any irregular firing of events or no firing of events occur again
Regards
The unexpected dialog that appears, is it an assertion or an error dialog coming from the actual application? Does it always appear after performing specific actions?
It is an error dialog coming from the actual application. It appears only when certain conditions fail. The event was not fired all the time during the error(condition failure) case.
Based on past experience, if the application throws an unexpected error message, I won’t automate it. This is mainly because the next steps may not produce the expected results due to the previous error. However, if the error message consistently appears after performing certain actions, then I can easily handle it without using event handlers.
Regardless of the project settings, the event handler should be triggered, provided it meets the requirements. More information can be found in https://support.smartbear.com/testcomplete/docs/testing-with/running/handling-errors/unexpected-windows.html.