通过脚本启动QTP,运行测试脚本

通过脚本启动QTP,打开并运行一个新测试:
 我之前项目中用到一个简单的启动脚本,分享给大家参考:
Dim G_TestPath'项目所在测试根目录
Dim qtApp'QTP应用程序
set ws=CreateObject("WScript.Shell")
G_TestPath = ws.CurrentDirectory'自动获取项目所在测试根目录
Set qtApp=createobject("QuickTest.application")
qtApp.Launch
qtApp.visible=True '可见为True
qtApp.Open G_TestPath'Open当前项目
Set qtTest = qtApp.Test
qtTest.Settings.Launchers("Web").Active = False'不开启IE浏览器
'qtTest.Settings.Launchers("Web").Browser = "IE"
'qtTest.Settings.Launchers("Web").CloseOnExit = True
qtTest.Settings.Launchers("Windows Applications").Active = True
qtTest.Settings.Launchers("Windows Applications").Applications.RemoveAll
qtTest.Settings.Launchers("Windows Applications").RecordOnQTDescendants = True
qtTest.Settings.Launchers("Windows Applications").RecordOnExplorerDescendants = False
qtTest.Settings.Launchers("Windows Applications").RecordOnSpecifiedApplications = True
qtTest.Settings.Run.IterationMode = "rngAll"
qtTest.Settings.Run.StartIteration = 1
qtTest.Settings.Run.EndIteration = 1
qtTest.Settings.Run.ObjectSyncTimeOut = 10000
qtTest.Settings.Run.DisableSmartIdentification = False
qtTest.Settings.Run.OnError = "NextStep"
qtTest.Settings.Resources.DataTablePath = "<Default>"
qtTest.Settings.Web.BrowserNavigationTimeout = 15000

qtTest.Run '开始运行测试

 来自:http://blog.csdn.net/xifeijian/article/details/8456373

你可能感兴趣的:(qtp)