Forum Discussion

BMD's avatar
BMD
Contributor
11 years ago

Refreshing the object tree.

Team,

I have a client/server application to loads a second page or window.  When it returns to the main application window it does not recognize any of the objects.  I have tried to refresh the object tree in many ways, five are listed below.



Sys.Process("eData").Refresh();

NameMapping.Sys.edata.RefreshMappingInfo();

Sys.Refresh();

Aliases.RefreshMappingInfo();

NameMapping.Sys.RefreshMappingInfo();



I’m quite sure this is the problem as I put in a delay and manually closed the application and restarted it and after the delay the script continues.  BUT, without restarting the application it times-out and stops.



I have checked the ‘Extended find’ in the mapped objects and reran the test with the refreshing options but that too did not reload the object tree like it does when I restart the application. 



If I start the application and then start to run a TC script it takes about 15 seconds to start as it is building the object tree.  In short I want TC to trash and rebuild the object tree.



I'm using TC9.20, JScript on Win7.

Any Help, Thanks,

BMD.

4 Replies

  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi,


     


    How exactly do you run your applications? Do you use Run As of the TestedApp object? 


    I guess that this behavior may be related to the fact that the applications and TestComplete are run under different accounts. As a result, TestComplete cannot get access to the objects of your apps. Can you check this?


     


    BTW, can you check if the same issue is reproduced in the latest TestComplete 9 version - v. 9.31?


     

  • BMD's avatar
    BMD
    Contributor
    1) Starting the application

    I start the application by getting the OS (var OSName = NameMapping.Sys.OSInfo.Name) and then starting it from the start run and entering the path to the .exe.  Using the internal tested apps of TC does not work correctly.  If I use tested apps and start to use the application it returns errors about missing .dll’s that TC does not load correctly.  I have been starting the application this way for many years because tested apps, does not start this application correctly.

     

    2) Access to objects

    When I first start the application all the mappings are working and if I use the Object Spy everything is found and works.  I see there are three (3) sections listed under the properties of the object spy, being, standard, extended and visual basic.   After the problem happens I noticed that if I use the Object Spy the visual basic properties is missing from the list.  This is why I thought the solution was (NameMapping.Sys.edata.Refresh();) to refresh the entire eData object tree.  This I thought would restore the object tree.  None of the commands to refresh object tree work and the only solution I have found so far is the restarting of the eData program. 

     

    3) Different account

    I guess I don’t understand your question here; because it does work and then stops.  I don’t see how that could be account related.

     

    4) The point of failure

    Sometimes but not always, when the application loads forms and kind-of starts a different mode, when it returns to the main program is when the mappings are lost.  Because of this each time the scripts load, correct, enter, update, or do anything with a form I restart the application. 

     

    Thanks, for any and all help.  These scripts have been running and working for years.

    BMD

  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi,


     


    If this scenario and script have been working for years, what has changed now? Did you install another TestComplete version or some new software on the computer? Was your environment changed somehow?


     

  • BMD's avatar
    BMD
    Contributor
    I do not know what changed, if I knew I would fix it.  The scripts were written in an older version of TC but have run in TC 9.20 many times.  Why this has come up now is unknown to me. 

     

    Your three questions point to the system or the environment, but not how to address the problem.  How do you get TC to completely rebuild the object tree during script execution?  The scripts all run but it certain times I need to close the application and restart it.  This is the only way to get TC to rebuild the object tree.  My question is “How do you get TC to rebuild the object tree during test execution?”

     

    Thanks,

    BMD