04-23-2012, 05:15 PM
Hi,
You can not run more than 1 test parallelly.
You can run the test sequentially using Batch Runner or define your custom Batch Runner Script.
1) Create a excel with test case name and markes yes or no depending your execution requirement.
2) Use QTP object model to create QTP object.
3) Read from excel take the test case name for which execution status marked as yes.
4) Define your test case path.
4) Use loop to open each test case (using test case path+ Test case name) and execute the test case using QTP Automation object.
Sample Code:
Regards,
Mrinal Nandi
Automation Tester
You can not run more than 1 test parallelly.
You can run the test sequentially using Batch Runner or define your custom Batch Runner Script.
1) Create a excel with test case name and markes yes or no depending your execution requirement.
2) Use QTP object model to create QTP object.
3) Read from excel take the test case name for which execution status marked as yes.
4) Define your test case path.
4) Use loop to open each test case (using test case path+ Test case name) and execute the test case using QTP Automation object.
Sample Code:
Code:
strTestScriptFolderPath="E:\Alpha Centauri\QA Automation\Test Scripts\"
Set objQTPApp=CreateObject("QuickTest.Application")
objQTPApp.Launch
objQTPApp.Visible =True
Set objInputDataFile=CreateObject("Excel.Application")
'Opening Input data Excel in Read - Write Mode
objInputDataFile.Workbooks.Open inputExcelpath,True,True
Set objCurWorksheet=objInputDataFile.ActiveWorkbook.Worksheets(1)
intRowCnt = objCurWorksheet.UsedRange.Rows.Count
For intCurRow=2 to intRowCnt
strExeKeyword=objCurWorksheet.Cells(intCurRow,5)
If LCase(Trim(strExeKeyword))="yes" Then
strTestScriptsName=objCurWorksheet.Cells(intCurRow,4)
x=strTestScriptFolderPath&strTestScriptsName
objQTPApp.Open x, False, False
Set objQTPTest= objQTPApp.Test
objQTPTest.Save
Set objQTPResultsOpt=CreateObject("QuickTest.RunResultsOptions")
objQTPResultsOpt.ResultsLocation="<TempLocation>"
objQTPTest.Run objQTPResultsOpt
strResultStatus=objQTPTest.LastRunResults.Status
If strResultStatus="Warning" Then
strResultStatus="Passed"
End If
objCurWorksheet.Cells(intCurRow,6)=strResultStatus
'objQTPTest.Close
End If
Next
objInputDataFile.Activeworkbook.SaveAs strExectionResultPath
objInputDataFile.Activeworkbook.Close
objInputDataFile.Quit
Regards,
Mrinal Nandi
Automation Tester