Forum Discussion
Idan,
I tried checking if the project variable it is assigned to != null when the test starts and only to call the constructor in case the variable ==null , but it is always null when starting a test even though the object is still active).
Project variables that store object references are not persistent. That is, they don't store their values between test runs.
This is even more troublesome, as once the constructor is called upon from testcomplete, testcomplete simply freezes and has to be forcefully killed.
Does this occur when you call the object constructor for the second time? If it does, perhaps, this happens due to some specific behavior of the object's constructor: it does not respond to the call, and this causes TestComplete to fail.
Currently, it's difficult to understand what is going wrong as I don't know the code of your C# object and the way the object is used. TestComplete loads assemblies when it accesses the CLR Bridge in your project for the first time. The assemblies remain loaded until the project is closed or changed. So, most likely, there are references to your object after the test run is over. To clean the references, I'd suggest doing this:
* At the end of the test run, remove all the references to the object in your .NET code (that is, clear the object that can hold links to your object).
* Call the following statements:
// Assign null to the project variable that stores the object reference
ProjectVariable = null;
// Call JScript's garbage collector.
// This is needed, because null assignment does not release the object reference immediately
CollectGarbage();
// Call .NET's garbage collector
dotNET.System.GC.Collect();
Hope this helps.
Related Content
Recent Discussions
- 2 hours agoSubhraDas