Forum Discussion

googleid_114358's avatar
googleid_114358
Contributor
12 years ago

Aliases within Script Extensions issue

Hello.



Once in a while, I am going to add several screenshot to explain my problem.



In order to make our script extensions work with several application, we defined a MGManager script extension that provide access to Aliases object. Those object are actually pointer to the real aliases object withitin TestComplete engine.



I might have missed something, but I don't understand why my MGMainAliases (defined with Aliases.MGDIS_LanceurNET) is not equal to the Aliases object.



Behind this issue, I have a Script Extension problem, because, when I am trying to do something like MGMainAliases.ChildNumberOne, TestComplete says ChildNumberOne does not exists, while Aliases.MGDIS_LanceurNET.ChildNumberOne does !



Any idea ?



Cheers.



Guillaume.
  • rgratis's avatar
    rgratis
    Frequent Contributor
    Not certain how you have written your script extension, but could it be that your MGMainAliases runtime object is storing an out-of-date copy of the Aliases.MGDIS_LanceurNET object?  When objects in the tree are created and destroyed, TestComplete's Aliases automatically refreshes and resets all its pointers to the new objects, but if you have stored a copy in a variable, this variable does not get automatically refreshed.  It still points to the original object, which no longer exists.



    To get around this, I have a little "checkObjects" function in my script extensions that does something like "if storedObject.Exists = False then storedObject = Aliases.<whatever>" and basically reassigns the variable. I then call "checkObjects" before trying to do anything within the script extension to make certain I'm not working with a dead copy.