cancel
Showing results for 
Search instead for 
Did you mean: 

Persisting UI Object

SOLVED
Highlighted
Established Member

Persisting UI Object

Is it possible to persist UI object variables across automation runs?

 

I have a peculiar scenario:

1. I am invoking TestComplete functions from Java. 

2. From Java, I call TestComplete Functions to launch App 1 and App 2.

3. From Java, I call a TestComplete Function to pefrorm certain action on the App 1 UI.

4. From Java, I call a TestComplete Function to pefrorm certain action on the App 2 UI.

5. Now again from Java, I want to call a TestComplete Function to pefrorm certain action on the App 1 UI.

 

At step 5, the objects recognized during step 3 are no longer valid. So, just wondering if it is possible to persist the UI objects and Arrays created in step 3, and resuse them directly in step 5.

 

Any suggestions / workarounds please?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Manager

Re: Persisting UI Object

Community, thanks a lot for your great suggestion!

 

my 2 cents... 

It's possible to save the data that you will need to use from run to run as a separate file. Refer to the following help article explaining how to work with files from scripts:

https://support.smartbear.com/testcomplete/docs/testing-with/advanced/working-with-external-data-sou...

 

Please mark the best answer as a solution.

 

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️

View solution in original post

5 REPLIES 5
Highlighted
Community Hero

Re: Persisting UI Object

No.  Variables are emptied and re-initialized between test executions.  


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
Highlighted
Community Hero

Re: Persisting UI Object

https://support.smartbear.com/testcomplete/docs/testing-with/variables/data-types/object.html

Object type variables have global visibility scope and can be used to obtain an object from any keyword test or script unit or to exchange data between tests or units. These variables are available even when a test run is terminated and script variables do not exist.

 

 

 

If all your steps are being run in one pass inside one project or project suite, then you have project variables or project suite variables that will persist.  Once the test run ends, then the values are gone.

 

 

 

Highlighted
Community Hero

Re: Persisting UI Object

Hi,

 

While generally speaking this might appear to be possible (your description is just not detailed enough), persistance of the variables that keep references to UI objects is far not the best practice.

The reason is that if the referenced object is re-created by the tested application, its reference that is kept in the variable will be invalidated. This will result in .Exists property to return False and test code will need to search for the new object again.

Exact implementation of test code (its architecture) obviously depends on your knowledge of the tested application internals, but you need to keep in mind the above details.

 

Regards,
  /Alex [Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
Highlighted
Community Manager

Re: Persisting UI Object

Community, thanks a lot for your great suggestion!

 

my 2 cents... 

It's possible to save the data that you will need to use from run to run as a separate file. Refer to the following help article explaining how to work with files from scripts:

https://support.smartbear.com/testcomplete/docs/testing-with/advanced/working-with-external-data-sou...

 

Please mark the best answer as a solution.

 

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️

View solution in original post

Community Manager

Re: Persisting UI Object

Hi @tarunaggarwal23 , did any of the suggestions help?


Sonya Mihaljova
Community and Education Specialist
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors