Ask a Question

Object Not Found when Process is Closed and Reopened

SOLVED
MattMauger
Occasional Contributor

Object Not Found when Process is Closed and Reopened

Hi, 

 

I've been having an issue when my application is closed and reopened in the same test (or test suite). A test will run successfully the first time but if the exact same test is run again the objects cannot be found.

 

The objects have the exact same definition when viewed through the object explorer. The only difference between the instances as far as I can tell is the process Id. I have done several different checks and the original instance is definitely fully closed before the other instance opens. 

 

The error is either object not found or JavaScript runtime error RPC Server is undefined. 

 

All my variables are defined in a separate unit and evaluated when needed, if I use the same definition but a different name for the variables it works fine. I'm thinking test complete is still storing the original definition somewhere. I've tried using RefreshMappingInfo to redefining the process, this does remove the processes definition but does not solve the issue when it is redefined. 

 

I'm still quite new to TestComplete so sorry if this is obvious.

 

Thanks for your help, 

 

Matt

 

1 ACCEPTED SOLUTION

Accepted Solutions
MattMauger
Occasional Contributor

Re: Object Not Found when Process is Closed and Reopened

I've realised and solved the problem, I was saving the objects back over the definitions in my Variables Unit (I started doing this to save the number of variables I needed to define when I first started making tests). Thanks for your help 

View solution in original post

4 REPLIES 4
tristaanogre
Community Hero

Re: Object Not Found when Process is Closed and Reopened

How are you identifying the object?  Are you using NameMapping to do the object identification?  Or are you using some other method?  If you're capturing the process using something other than NameMapping, the process object is no longer valid when the process is closed and then re-opened because assigning the process that way assigns the specific process.  If you reference the process using NameMapping, it does a check to see if the process is present and, if so, returns what it finds rather than storing the information from a previous instance.


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
MattMauger
Occasional Contributor

Re: Object Not Found when Process is Closed and Reopened

Hi, thanks for the quick reply,  I'm not using NameMapping no, I've written them out as strings in a separate unit and using eval() to call them. 

MattMauger
Occasional Contributor

Re: Object Not Found when Process is Closed and Reopened

I've realised and solved the problem, I was saving the objects back over the definitions in my Variables Unit (I started doing this to save the number of variables I needed to define when I first started making tests). Thanks for your help 

tristaanogre
Community Hero

Re: Object Not Found when Process is Closed and Reopened

As I understand it, you've basically, in code, replicated the NameMapping feature to some extent but simply by using an "eval" to assign to a variable a current object.  

While it works to some extent, as you noticed, this has some inherent problems and can end up with performance problems, code maintenance problems when hierarchies change, etc.  I would recommend investigating the NameMapping feature and using it instead of your code method.


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
cancel
Showing results for 
Search instead for 
Did you mean: