|
哈哈,我是用vbs,把要运行的action都写到一个txt里面去,一个action一行,然后vbs读文件操作。。最后结果以Action名字存进result文件夹里面去,不过这个很精简,没有判断文件夹是否存在的操作。。
Dim qtApp 'As QuickTest.Application ' Declare the Application object variable
Dim qtTest 'As QuickTest.Test ' Declare a Test object variable
Dim qtResultsOpt 'As QuickTest.RunResultsOptions ' Declare a Run Results Options object variable
Set qtApp = CreateObject("QuickTest.Application") ' Create the Application object
Dim fso, f
Dim myReg
Dim myString,myResult
myString = ".*\\([^\:]+)"
qtApp.Launch ' Start QuickTest
qtApp.Visible = True ' Make the QuickTest application visible
' Set QuickTest run options
'qtApp.Options.Run.ImageCaptureForTestResults = "OnError"
qtApp.Options.Run.RunMode = "Fast"
qtApp.Options.Run.ViewResults = False
set fso = WScript.CreateObject("scripting.filesystemobject")
Set f=fso.OpenTextFile("D:\QTPScript\testcase.txt", 1, false)
For i = 1 To 5
Do While f.AtEndOfStream <> True
retstring = f.ReadLine
Set myReg = New RegExp
myReg.Pattern = myString
myReg.IgnoreCase = True
myResult = myReg.Replace(retstring,"$1")
qtApp.Open retstring, True ' Open the test in read-only mode
' set run settings for the test
Set qtTest = qtApp.Test
qtTest.Settings.Run.OnError = "NextStep" ' Instruct QuickTest to perform next step when error occurs
Set qtResultsOpt = CreateObject("QuickTest.RunResultsOptions") ' Create the Run Results Options object
qtResultsOpt.ResultsLocation = "C:\QTPScript\result\" & myResult & "_" & i ' Set the results location
qtTest.Run qtResultsOpt 'Run the test
Loop
Next
f.close
'MsgBox qtTest.LastRunResults.Status
qtTest.Close
'qtTest.Close ' Close the test
Set qtResultsOpt = Nothing ' Release the Run Results Options object
Set qtTest = Nothing ' Release the Test object
Set qtApp = Nothing ' Release the Application object |
|