godn_1981 发表于 2006-5-10 11:28:39

用命令行启动QTP并运行脚本

hi,大家好。
哪位用过用命令行启动QTP并运行脚本??
我现在想用一个批处理文件来执行一段脚本,使之完全成为自动测试?怎么调用?
谁能帮助一下,谢谢。。

tomzhang 发表于 2006-5-25 11:05:41

很好的想法!这个可以用TD来定时实现!

linglong 发表于 2006-5-25 16:59:42

可以编写一个脚本,用它来操纵QTP的运行

下面内容拷贝自QTP的帮助文档
Dim qtApp 'As QuickTest.Application ' Declare the Application object variable
Dim qtOptions 'As QuickTest.RunResultsOptions ' Declare a Run Results Options object variable
Set qtApp = CreateObject("QuickTest.Application") ' Create a Application object

' Open the test
qtApp.Open "C:\Tests\Test1", False ' Open a test named "Test1"
qtApp.Test.Settings.Resources.DataTablePath = "e:\default.xls"   'add by me
qtApp.Launch ' Start QuickTest
qtApp.Visible = True ' Make the QuickTest application visible

' Run the test
Set qtOptions = CreateObject("QuickTest.RunResultsOptions") ' Create a Results Option object
qtOptions.ResultsLocation = "<TempLocation>" ' Set the Results location to temporary location
qtApp.Test.Run qtOptions, True ' Run the test and wait for it to finish before continuing the automation script


'qtApp.Test.Save

' Save the Run-time Data Table
'qtApp.Test.LastRunResults.DataTable.Export "C:\Runtime.xls" ' Save the run-time Data Table to a file

qtApp.Quit ' Exit QuickTest
Set qtOptions = Nothing ' Release the Run Results Options object
Set qtApp = Nothing ' Release the Application object


至于该脚本的执行可以用 dos命令下的   cscriptxyz.vbs来实现

[ 本帖最后由 linglong 于 2006-5-26 09:38 编辑 ]

godn_1981 发表于 2006-12-7 15:32:06

感谢~~~~~~

非常感谢、、、、、

rivermen 发表于 2007-5-14 14:17:49

用过了,真的可以,谢谢
今天又有新收获了!!!

mustwangrong 发表于 2008-6-18 17:32:01

学习,mark

点点滴滴2010 发表于 2011-1-7 12:04:19

用过了,不错的.   但是看不到执行结果?

TIB 发表于 2011-1-7 12:09:46

可参考一下QTRunner:
http://blog.csdn.net/testing_is_believing/archive/2009/12/19/5037830.aspx

点点滴滴2010 发表于 2011-1-7 13:42:59

谢谢^

fz0000 发表于 2011-1-7 14:14:03

用wscriptxyz.vbs运行
页: [1]
查看完整版本: 用命令行启动QTP并运行脚本