Forum Discussion

kirk_bottomley's avatar
kirk_bottomley
Contributor
12 years ago

Window was destroyed during method execution

In the program being tested, there is a form that pops up with various radio selections. The user picks which options are needed, and on the last click, the window vanishes. This is by design, but TC still logs it as an error.
In the Additional Info tab, there is a suggestion to avoid the error, but it is of no help. The object is not recreated; it did its function and went away. Checking for the existence of the object before it goes away likewise doesn't prevent it from being logged as an error.

In one of the other threads dealing with this, someone suggested a bit of code in the OnError event handler, but I'm having problems translating their code to Java, if indeed it is a viable solution. When I try to catch the error, there is no information in LogParams to latch onto to trigger anything.

I have also tried turning the keyword test into a script, and putting the button clicks into a Try-Catch block to try to intercept the error, but no luck there either.

To sum up: The button is successfully clicked, the object is supposed to destroy itself, but it shows up as an error in my logs. Suggestions?

1 Reply

  • Using the Locked property, I created an error handler for OnLogError events.




    function GeneralEvents_OnLogError(Sender, LogParams)


    {


        if (LogParams.MessageText == "The window was destroyed during method execution.")    


        {


          Log.Message(LogParams.MessageText)


          LogParams.Locked = true


        }


    }



    I still log the message, but the logs don't show a failure. The only problem now is, if a window is destroyed unintentionally, I won't see the failure immediately, but I'll still see the "window destroyed" message in the logs where I'm not expecting to see it, so it's not a complete loss.

    If anyone has a better suggestion, I'm open to them. Otherwise, I will note this as closed and move on.