Forum Discussion

MulgraveTester's avatar
MulgraveTester
Frequent Contributor
9 years ago
Solved

Close the tested app without getting error logged

My script needs to close the test application so that it can default the DB before starting it again. My script functions correctly but the log always posts an error "The test.exe process crashed." when I use call sys.Process("test.exe").close

 

How can I prevent TestComplete from logging an error when I deliberately close an application?

  • I had a problem where one of the forms would close by simply vanishing, and it kept logging an error of "The window was destroyed during method execution." The developers eventually closed the form properly, but for a while, I just had to have an event handler that looked to see if the error said that specific thing, logged it, and moved on.

    The downside is that if a window actually did crash with that error unexpectedly, it could easily be missed, but I couldn't have it logging errors every run either.

     

    function GeneralEvents_OnLogError(Sender, LogParams)
    {
        if (LogParams.MessageText == "The window was destroyed during method execution.")    
        {
          Log.Message(LogParams.MessageText)
          LogParams.Locked = true
        }
    }

    You can alter the message text to suit your error, and change the log entry to a warning or something to call more attention to it. Just keep in mind that any legitimate errors that throw the message won't get flagged.

1 Reply

  • I had a problem where one of the forms would close by simply vanishing, and it kept logging an error of "The window was destroyed during method execution." The developers eventually closed the form properly, but for a while, I just had to have an event handler that looked to see if the error said that specific thing, logged it, and moved on.

    The downside is that if a window actually did crash with that error unexpectedly, it could easily be missed, but I couldn't have it logging errors every run either.

     

    function GeneralEvents_OnLogError(Sender, LogParams)
    {
        if (LogParams.MessageText == "The window was destroyed during method execution.")    
        {
          Log.Message(LogParams.MessageText)
          LogParams.Locked = true
        }
    }

    You can alter the message text to suit your error, and change the log entry to a warning or something to call more attention to it. Just keep in mind that any legitimate errors that throw the message won't get flagged.