Forum Discussion

TechnoBill's avatar
TechnoBill
Occasional Contributor
14 years ago

waitWinFormsObject not recognising objects or ignoring timeout

Test Complete 8  seems to be having problems recognising objects intermittently

We use Test Complete to to test a very complex .net application. We can run the same code many times and sometimes it works and other times it stops waiting for objects even though we know they are there.

We have been noticing more an more that it is having trouble identifying objects that are actually there. Even hitting pause we can then go to object in the object browser. But continuing the code it still sits there waiting for that object.



The other issue is that when it gets into this 'Blind mode' where it cant seem to see things, it does not seem to be using the timeout value.



For example, the code below to set to wait 5 seconds for the reminder form.  It works most times but occassional the reminder is displayed, but the little playback control shows a message like "waiting for waitWinFormsObject("frmReminder") and sites there for a very very long time, its like it is ignoring the 5 second timeout we set in the code.

If we hit pause button and wait a very very long time, we can go it object broweser copy path for the form and it is exactly as in in the code but it still does not find it and we dont know why it waits more than the time we have told it 


dim w1

set w1 =Sys.Process("CareLinkPlus").frmCarelinkPlusMDI.WinFormsObject("MdiClient", "").waitWinFormsObject("frmReminder",5000)

if w1.exists then 

    
call w1.WinFormsObject("Button", "OK").click

end if

3 Replies

  • TechnoBill's avatar
    TechnoBill
    Occasional Contributor
    OK I have isolated the problem we are having.

    There appears to be something wrong with the waitWinFormsObject time out.

    In the example show below, the object barBottomDockSite exists but the dockGlobalAssistant does not

    if put a breakpoint on the line set w2=w1.waitWinFormsObject("dockGlobalAssistant",1000) and then execute the statement I can then see how long before it moves to the next line in debug mode.



    I run the code, it quickly executes the previous statements and stops on the break point as expected on: set w2=w1.waitWinFormsObject("dockGlobalAssistant",1000)

    I then press then key to execute that line and it waits about 20-30 seconds (waiting for winforms object("dockGlobalAssistant")  ) before it goes to the next line. Also one thing I notice when we see this behaviour iss that the little progress bar that is shows when it is wating for an object does not progress.  Depending on the value we put into the statement, the wait progress bar shows up partially populated but is not progressing.  



    if I change the value to anything <200 or so it seems to work OK and goes to the next line almost instantly but any values higher than that (300 or 400, etc that should still be well under 1 second wait), it waits at least 25 seconds.

     Its as though its using some default timeout for values instead of the of the values I am specifying.

     

    I have tried changing the Auto-wait timeout in the Default project properties to values ranging from 10  to 25000 and this makes no difference to this problem.




    sub igCloseGlobalAssistant

        dim w1,w2

        set w1 = NameMapping.Sys.clp.frmCarelinkPlusMDI.waitWinFormsObject("barBottomDockSite",10000)

        if w1.exists then

            set w2=w1.waitWinFormsObject("dockGlobalAssistant",1000)  

            if w2.exists then 

                Log.Message("Closing Global Assistant")

                call w2.click(10,10)

            end i

        end if

    End Sub


    igCloseGlobalAssistant    dw1,w2    sw1 = NSclp.frmCarelinkPlusMDI.waitWinFormsObject("barBottomDockSite",10000) w1.exists w2=w1.waitWinFormsObject("dockGlobalAssistant",1000)          iw2.exists t        ei
  • Hello Bill,



    The real time of waiting for an object can differ from the Timeout value specified for the WaitWinFormsObject method. Please pay attention to the following remark in the WaitWinFormsObject Method article:




    Note that Timeout value is not strict and if the tested application is busy, TestComplete could wait for the object for a longer period of time than it is specified by the parameter. The following can cause this:



    A call to any WaitXXXObject method causes the object tree to refresh. To update object data, TestComplete may call some of object’s native methods that are accessible only from the application’s thread. When the thread is busy, TestComplete tries to call those methods during some pre-defined time (one second) thus delaying the refresh. There could be several attempts to get the object’s data which could result in a noticeable difference from the Timeout value.




    As for the problem with the dockGlobalAssistant object, I recommend that you try handling it as described in the Handling the 'Object Does Not Exist' Error help topic. Does this help?
  • TechnoBill's avatar
    TechnoBill
    Occasional Contributor
    Thanks for the explanation but this was definately a different beast and we can only assume it was caused by corruption of the settings somewhere.

    We have been testing our application with test complete for many years and never experienced this particular problem.  Then basically on the day I reported the problem all of out tests were failing randomly for no apparent reason.

    We resolved the issue by completely uninstalling Test Complete from that test machine and reinstalling it. The tests all started working correctly with the correct timeouts (rather that what seemed like infinity) problem has not resurfaced (touch wood).

    It would have been nice to identify the specific cause, but as usual we were under great presssure to complete our testing. 



    Thanks 

    Bill D