Forum Discussion

jsc's avatar
jsc
Regular Contributor
14 years ago

unexpected window - test stopped despite active error handling

Hi all,



on my last test, an error window popped up. My test stopped on this window, I expected the test to keep on running and handling this unexpected window.



My settings are:

1) on unexpected window:

a) click on focused control

b) Press Esc

c) Press Enter

d) Send WM_Close



a), b) and c) would have closed the window (I did not try d)), but it kept open...



My Error (code see below) handler did not do anything at all. There was no Error.Log entry pointing to an unexpected window.



Can anybody help me, what went wrong?



Kind regards,



Joachim







Error handler:



function OnUnexpectedWindow(Sender, Window, LogParams)

{

  //LogParams.Locked = true;



  // Post an error message about unexpected windows to the test log

  Log.Error("Unexpected window");



  // Post an image of the whole screen to the test log

  Log.Picture(Sys.Desktop.Picture(), "Unexpected window", "This image was added to TestLog from the GeneralEvents_OnUnexpectedWindow procedure");



  // Close the unexpected window

  Window.Close();

}
  • AlexKaras's avatar
    AlexKaras
    Icon for Champion Level 3 rankChampion Level 3
    Hi Joachim,



    If you have Project Properties | Project | Playback | Runtime | Stop on error option set (which is default), then you may try to disable (un-check) it.
  • jsc's avatar
    jsc
    Regular Contributor
    Hi Margaret,



    the most probable reason for the window to not being treated as unexpected is, that it is a delphi window.

    I read the other article about unexp window beforehand, this wasn't mentioned there.



    thanks for your help,



    Joachim
  • Hi Joachim,


    Yes, currently, TestComplete does not handle unexpected windows in Delphi CLX applications. This is due to specifics of the CLX library implementation: an application’s window can be activated even when a modal dialog is displayed. Due to this behavior, TestComplete does not treat modal CLX windows as unexpected.