Forum Discussion

maxtester's avatar
maxtester
Contributor
8 years ago

How to rerturn an objct of a GUI- componente so that object is not destroyed after close GUI

Hello all,

 

I have the following problem:

 

I call from unit A a function in unit B. In B I open a dialog and get a gui object which is returned. As long as the dialog is opened I can see all the properties of the object in unit A. When I close the dialog the object is empty. How can I handle this problem (copy Obeject, declaration...)?

5 Replies

  • AlexKaras's avatar
    AlexKaras
    Icon for Champion Level 1 rankChampion Level 1

    Hi,

     

    No way.

    TestComplete operates with the objects that are provided by the tested application. When the object is destroyed in the tested application TestComplete cannot access it because the object does not exist anymore.

  • My tested application is a WPF- application with plenty dialogs. For example I create something in one dialog and beed to verify severall informations in another. Or I need to make some database calls based on the informations. To keep my automation and functions within a dialog unit as dynamic as possible I want to return as much informations as possible. So the easiest way is to return the objects which I need for further verifications or actions. I do not need the methods but only the properties. I have created a function which gets all properties from the object. This is ok for me

     

    • AlexKaras's avatar
      AlexKaras
      Icon for Champion Level 1 rankChampion Level 1

      Hi,

       

      Yes, this is the way to go. Initial objects from the tested application cannot be persisted in TestComplete, so you must create copy of the data that you need later. Depending on your test project scripting language, data may be preserved as a file, JSON object, a temporary Project Variable of Table type, etc.

  • Ok, so the only way is to make a copy of the object. I tried it with lodash but it fails. I think that I need to create a function which copies only the properties

    • tristaanogre's avatar
      tristaanogre
      Esteemed Contributor

      What is the reason why you need access to the object after it is closed in the application?  Are you doing validation against it? Are you using information from it for other tests?  It depends upon what you're looking at doing as to what the better solution is.