Does anyone know how to drill down into Events in TestPartner? I have a block of code which checks to see if a DotNETForm is active, and prints out an error if it isn't.
Well, the target DotNETForm IS in fact active, but the code generates an error message anyway. It looks like this:
Shell strLocalGlad & "\bin\System\Server Options.exe", vbNormalFocus 'this runs the Server Options application, which is supposed to display a .NET window form
If Wait(5, "Open_Server_Options", tpWaitSeconds) = False Then
MsgBox "Failed to open the Server Options Utility"
Open_Server_Options is defined as a window event.
Attach name = "Name=GroupBox1 Application='SERVER OPTIONS.EXE'"
Window event = Exists
The attached file shows the .NET form displayed. As I said, even though it is displayed, the error message is still generated, which doesn't make sense. Why does this happen? Am I missing something? Please advise. Thanks.
As I mentioned in one of my earlier posts based on over 10 years of experience and understanding how window events work I would not use them as a means of synchronization.
When creating solid, repeatable test I use screen events and not window events. The reason is that window events work off of window messages. This is to say that in your case of the exists, a window announces to the O/S that it exists only once. It is not repeated. By default TestPartner's polling of window messages is every 1 second. This means that every other second TestPartner is not "listening" and if the exists message happens during that not listening second it appears that TestPartner does not catch the message. This is true.
A better practice would be to use the screen event. This makes use of the attach name of the window as well as the windows existence. This will allow TestPartner to find the window during it's polling and for the event to return as true.