Forum Discussion
7 Replies
- simon_gletRegular Contributor
- someshg2Occasional ContributorOk..thanks simon , I will try with that hope it works
Regards,
G.Someswara Rao - someshg2Occasional ContributorHi..Simon
I tried with the following code in vbs file
Sub MySub
' Initialize variables
sProjectNameFileName = "C:\Users\u304080\Desktop\26_07_2013\Shakedowns\Shakedowns.pjs"
sProjectName = "Scenarios"
sUnitName = "aaaaaa"
sRoutineName = "funHi"
' Creates the application object
Set TestCompleteApp = CreateObject("TestComplete.TestCompleteApplication")
' Obtains the integration object
Set IntegrationObject = TestCompleteApp.Integration
' Opens the project
IntegrationObject.OpenProjectSuite sProjectNameFileName
' Checks whether the project was opened
If Not IntegrationObject.IsProjectSuiteOpened Then
MsgBox "The project suite was not opened."
Exit Sub
End If
' Runs the routine
IntegrationObject.RunRoutine sProjectName, sUnitName, sRoutineName
End Sub
It doesnot respond ..Can you please check it !!!
Regards
G.Someswara Rao - simon_gletRegular ContributorHi,
Well this works fine on my side:
MsgBox "Start"
' Creates the application object
Set TestCompleteApp = CreateObject("TestComplete.TestCompleteApplication")
' Obtains the integration object
Set IntegrationObject = TestCompleteApp.Integration
' Opens the project
IntegrationObject.OpenProjectSuite "C:\myProjectSuite.pjs"
' Checks whether the project was opened
If Not IntegrationObject.IsProjectSuiteOpened Then
MsgBox "The project suite was not opened."
else
MsgBox "Project opened"
End if
MsqBox "End"
Keep in mind that TC must not be running before starting the script. Check your tasklist for wscript.exe running forever.
You might want to check C:\Users\yourAccount\AppData\Roaming\SmartBear\TestComplete\9.0\Sileng.log for issues.
In this case, I would not use vbscript without a proper debugging tool. You might want to checkout Powershell.
Sincerely - someshg2Occasional ContributorHi..Simon,
Thanks for the reply, well you said that TC must not opened before starting the VBS file. My requirement is "Start the Script routine when TestComplete is already opened", Can u please help me in that way.
Regards,
G.Someswara Rao - simon_gletRegular ContributorHi,
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 theTestComplete
object. This object implements methods and properties to connect and work with TestComplete. You can create a connection by calling Visual Basic’sCreateObject
function and passing theTestComplete.TestCompleteApplication
orTestComplete.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 - someshg2Occasional ContributorThanks..simon for the reply ....i will try that which is more helpfull for me
Regards,
G.Someswara Rao
Related Content
- 2 years agoianlop
- 11 months agoIso_Yura
- 6 years agovthomeschoolmom
- 11 years agojose_pita
Recent Discussions
- 2 days agoGane195