Forum Discussion
It makes it easier if it not already running but you can connect to it if its running. The following works:
function getTestRunner(){
if (Get-Process | Where-Object {$_.ProcessName -eq "TestComplete"}){
try {
return [System.Runtime.InteropServices.Marshal]::GetActiveObject("TestComplete.TestCompleteApplication")
} catch {
Write-Host "Could not connect to running testRunner. Will kill it and try again"
}
} else {
# if the script was started with no licenses left, this function will never return.
return New-Object -ComObject "TestComplete.TestCompleteApplication"
}
}
As for VB the documentation states:
The first step in using TestComplete as a COM server is connecting to it. To create a connection, you have to create a reference to the TestComplete
object. This object implements methods and properties to connect and work with TestComplete. You can create a connection by calling Visual Basic’s CreateObject
function and passing the TestComplete.TestCompleteApplication
or TestComplete.TestCompleteApplication.9
program id to it as a parameter:
Set TestCompleteObject = CreateObject("TestComplete.TestCompleteApplication")
This line launches a new instance of TestComplete. If TestComplete is already running, use the Set TestCompleteObject = GetObject(,"TestComplete.TestCompleteApplication") line instead.
Sincerely
Related Content
- 2 years agoianlop
- 11 months agoIso_Yura
- 6 years agovthomeschoolmom
- 11 years agojose_pita
Recent Discussions
- 2 hours agoSvetaG