Forum Discussion
master_mind01
13 years agoNew Contributor
Thanks for the reply.
If bat file is launching TestExecute, that will be an instance of TestExecute running.
If only one instance of TestComplete or TestExecute can be run at one time, doesn't CreateObject function try to create and run another instance of the TestExecute or TestComplete?
I received an instance of TestExecute or TestComplete is already running error message.
Content of main bat file:
@echo off
tasklist /FI "IMAGENAME eq TestExecute.exe" | find /I "TestExecute.exe"
IF ERRORLEVEL 2 GOTO Test2
echo start scripts
pause
@echo on
:Test2
taskkill /IM TestExecute.exe /F
Start /wait "TestExecute" "C:\Program Files (x86)\Automated QA\TestExecute 8\Bin\TestExecute.exe"
call RunTest.bat
Content of RunTest.bat file:
@echo off
start C:\Users\dummy_user\Desktop\TestExecuteVIACom.vbs
TestExecuteVIACom.vbs
Sub Test
Dim TestCompleteApp, IntegrationObject, LastResult
' Creates the application object
Set TestCompleteApp = CreateObject("TestComplete.TestCompleteApplication")
' Obtains the integration object
Set IntegrationObject = TestCompleteApp.Integration
' Opens the project
IntegrationObject.OpenProjectSuite("C:\TestComplete_Folder\Project_NameFolder\Project_Suite.pjs")
' Checks whether the project suite was opened
' If the project suite cannot be opened, closes TestComplete
If Not IntegrationObject.IsProjectSuiteOpened Then
MsgBox "The project suite was not opened."
' Closes TestComplete
TestCompleteApp.Quit
Exit Sub
End If
' Needed to process errors
Err.Clear
'On Error GoTo Err_Label
' Starts the project run
'IntegrationObject.RunProject "MyProject"
IntegrationObject.RunProjectTestItem ("MyProject,Login")
' Waits until the test is over
While IntegrationObject.IsRunning
DoEvents
Wend
' Checks the results
Set LastResult = IntegrationObject.GetLastResultDescription
Select Case LastResult.Status
Case 0: MsgBox "The test run finished successfully."
Case 1: MsgBox "Warning messages were posted to the test log."
Case 2: MsgBox "Error messages were posted to the test log."
End Select
Err_Label:
' Process errors
If Err.Number <> 0 Then
MsgBox "Cannot start the test. Reason: " + Err.Description, vbCritical, "Error"
End If
' Closes TestComplete
TestCompleteApp.Quit
End Sub
Please suggest.
Thanks,
MasterMind
If bat file is launching TestExecute, that will be an instance of TestExecute running.
If only one instance of TestComplete or TestExecute can be run at one time, doesn't CreateObject function try to create and run another instance of the TestExecute or TestComplete?
I received an instance of TestExecute or TestComplete is already running error message.
Content of main bat file:
@echo off
tasklist /FI "IMAGENAME eq TestExecute.exe" | find /I "TestExecute.exe"
IF ERRORLEVEL 2 GOTO Test2
echo start scripts
pause
@echo on
:Test2
taskkill /IM TestExecute.exe /F
Start /wait "TestExecute" "C:\Program Files (x86)\Automated QA\TestExecute 8\Bin\TestExecute.exe"
call RunTest.bat
Content of RunTest.bat file:
@echo off
start C:\Users\dummy_user\Desktop\TestExecuteVIACom.vbs
TestExecuteVIACom.vbs
Sub Test
Dim TestCompleteApp, IntegrationObject, LastResult
' Creates the application object
Set TestCompleteApp = CreateObject("TestComplete.TestCompleteApplication")
' Obtains the integration object
Set IntegrationObject = TestCompleteApp.Integration
' Opens the project
IntegrationObject.OpenProjectSuite("C:\TestComplete_Folder\Project_NameFolder\Project_Suite.pjs")
' Checks whether the project suite was opened
' If the project suite cannot be opened, closes TestComplete
If Not IntegrationObject.IsProjectSuiteOpened Then
MsgBox "The project suite was not opened."
' Closes TestComplete
TestCompleteApp.Quit
Exit Sub
End If
' Needed to process errors
Err.Clear
'On Error GoTo Err_Label
' Starts the project run
'IntegrationObject.RunProject "MyProject"
IntegrationObject.RunProjectTestItem ("MyProject,Login")
' Waits until the test is over
While IntegrationObject.IsRunning
DoEvents
Wend
' Checks the results
Set LastResult = IntegrationObject.GetLastResultDescription
Select Case LastResult.Status
Case 0: MsgBox "The test run finished successfully."
Case 1: MsgBox "Warning messages were posted to the test log."
Case 2: MsgBox "Error messages were posted to the test log."
End Select
Err_Label:
' Process errors
If Err.Number <> 0 Then
MsgBox "Cannot start the test. Reason: " + Err.Description, vbCritical, "Error"
End If
' Closes TestComplete
TestCompleteApp.Quit
End Sub
Please suggest.
Thanks,
MasterMind
Related Content
Recent Discussions
- 55 minutes ago