如何通过计划任务调用QuickTest测试脚本
(编辑:jimmy 日期: 2024/11/1 浏览:3 次 )
我们可以编写一个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
下一篇:如何调试JScript/VBScript的方法