我们可以编写一个Vbs脚本,直接在Windows平台下直接运行调用qtp的测试脚本,也可以将这个脚本添加到计划任务中,可以定时执行。
脚本如下:
---------------------------------------
复制代码 代码如下:
Dim qtApp
Dim qtTest
Dim qtResultsOpt
Set qtApp = CreateObject("QuickTest.Application")
qtApp.Launch
qtApp.Visible = True
qtApp.Open "C:\QuickTest Professional\tests\test1\test1.usr", True
Set qtTest = qtApp.Test
qtTest.Settings.Run.OnError = "NextStep"
Set qtResultsOpt = CreateObject("QuickTest.RunResultsOptions")
qtResultsOpt.ResultsLocation = "C:\QuickTest Professional\tests\test1\"
qtTest.Run
Set qtResultsOpt = Nothing
Set qtTest = Nothing
Set qtApp = Nothing
脚本如下:
---------------------------------------
复制代码 代码如下:
Dim qtApp
Dim qtTest
Dim qtResultsOpt
Set qtApp = CreateObject("QuickTest.Application")
qtApp.Launch
qtApp.Visible = True
qtApp.Open "C:\QuickTest Professional\tests\test1\test1.usr", True
Set qtTest = qtApp.Test
qtTest.Settings.Run.OnError = "NextStep"
Set qtResultsOpt = CreateObject("QuickTest.RunResultsOptions")
qtResultsOpt.ResultsLocation = "C:\QuickTest Professional\tests\test1\"
qtTest.Run
Set qtResultsOpt = Nothing
Set qtTest = Nothing
Set qtApp = Nothing