Forum Discussion
Tell us what version of TestComplete and what version of TestExecute you are running.
It would also be helpful to see your code. The more details we have, the easier it is for us to help you.
- anna_gl6 years agoOccasional Contributor
My TC and TE are both v.14. I upgraded both tools several days ago.
But before upgrade, when tools were v.12, same problem was there.
Here are my .Net codes.
public bool ConnectComObject() { try { TestExecuteObject = Marshal.GetActiveObject(TEProgID); } catch (Exception ex) { try { TestExecuteObject = Activator.CreateInstance(Type.GetTypeFromProgID(TEProgID)); } catch (Exception e) { Application.DoEvents(); } } if (TestExecuteObject == null) { return false; } TestExecuteManager = (ITestCompleteCOMManager)TestExecuteObject; IntegrationObject = TestExecuteManager.Integration; Application.DoEvents(); return true; }
First of the process, I call this method for start TE.
And call next code(it's a key part of full method), the variables such as 'param', 'projectName', 'unitName' are all has right value.(before this code I did validate variables value)
if (param == null) { IntegrationObject.RunRoutine(projectName, unitName, "Run"); } else { IntegrationObject.RunRoutineEx(projectName, unitName, "Run", param.ToArray()); }
When all unit process finished, I release the com object.
public bool DisconnectCom() { try { TestExecuteManager.Quit(); var releaseResult = Marshal.ReleaseComObject(IntegrationObject); IntegrationObject = null; releaseResult = Marshal.ReleaseComObject(TestExecuteManager); TestExecuteManager = null; releaseResult = Marshal.ReleaseComObject(TestExecuteObject); TestExecuteObject = null; GC.Collect(); GC.WaitForPendingFinalizers(); GC.Collect(); GC.WaitForPendingFinalizers(); } catch (Exception ex) { logger.Info("Exception : {0}", ex.Message); return false; } return true; }
The problem is that the next time I recall the first code(top code of here).
.Net project still run, and I have to recreate the TE process for next step.
Then the TE proccess created on windeow session but it becomes freeze status with indicator "Playback".
That indicator hang endlessly until manuallly kill the process.
I have to quit the process and restart it during the .Net program.
But I can't get any clue of this problem.
Once I thought it is related with rcw or ccw(it might be ccw..), but I don't know how control the ccw so please help me.
What I found out about ccw : https://docs.microsoft.com/en-us/dotnet/framework/interop/com-callable-wrapper
- Marsha_R6 years agoModerator
Are you sure that it's actually released after the first time through? It may take more time to clear than the code is allowing.
- anna_gl6 years agoOccasional Contributor
Actually I'm wondering about is my TE process really killed when I released the com object.
Even in my code, after releasing code I double check that is TE process still live by the code.public void ForceQuit() { Process[] currentProcess = Process.GetProcessesByName("TestExecute"); if (currentProcess.Any(x => x.ProcessName == "TestExecute")) { try { Process.Start("taskkill", "/F /IM TestExecute.exe"); currentProcess = Process.GetProcessesByName("TestExecute"); while (currentProcess.Any(x => x.ProcessName == "TestExecute")) { currentProcess = Process.GetProcessesByName("TestExecute"); //Application.DoEvents(); } } catch (Exception ex) { Console.WriteLine("Exception : {0}", ex.Message); } } }
As you mentioned above, it may take more time to clear than the code is allowing, but by this code, it still has the problem.
Are there more processes do I have to wait to be killed except that TestExecute process?
Related Content
- 2 years ago
- 10 months ago
Recent Discussions
- 2 days ago