|
Runlist.txt中写需要运行的Test列表
On Error Resume Next
error.clear
Dim qtApp
Dim qtTest
Dim qtResultsOpt
Dim fso, MyFile,TestName
Const ForReading = 1, ForWriting = 2
Set WshShell = CreateObject("WScript.Shell")
WshShell.Popup "开始批量执行自动化测试脚本!", 3, "AutoTest", 0 + 64
Set qtApp = CreateObject("QuickTest.Application")
qtApp.Launch
qtApp.Visible = False
qtApp.Options.Run.RunMode = "Fast"
qtApp.Options.Run.ViewResults = False
Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile = fso.OpenTextFile(".\RunList.txt", ForReading, True)
Do While MyFile.AtEndOfStream <> True
TestName = MyFile.ReadLine
qtApp.Open TestName, True
Set qtTest = qtApp.Test
qtTest.Settings.Run.OnError = "Dialog"
Set qtResultsOpt = CreateObject("QuickTest.RunResultsOptions")
qtResultsOpt.ResultsLocation = TestName &"\AutoRes"
qtTest.Run qtResultsOpt, True
'qtTest.close
Loop
MyFile.Close
qtApp.Quit
MsgBox "自动化测试脚本执行完毕!脚本测试结果存放在各自的AutoRes目录下,请用QTP result工具查看"
Set fso = Nothing
Set qtResultsOpt = Nothing
Set qtTest = Nothing
Set qtApp = Nothing
Set WshShell = Nothing |
|