在有些情况下,我需要启动和运行在命令提示符下一个QTP测试少数情况下。 例如,我想使用Windows任务计划程序运行在整个夜间不同时间QTP测试,但有(貌似)无标志,我可以使用具有QTP.exe打开并运行测试。 我怎样才能做到这一点?
Answer 1:
这是真的,用的QuickTest Pro,您不能直接通过调用运行测试C:\Program Files (x86)\HP\QuickTest Professional\bin\QTPro.exe "C:\Some Test\"
所有的希望都不会丢失但是,。 有一种方法来创建可以运行任意QTP测试时VBS文件被称为小VBS文件。 这比创建为每一个测试一个批处理文件好得多。
'*******************************************************************
'RunThisTest
'by Michael Innes
'November 2012
testResourcePath = "C:\Test Logs and Results\"
'Getting the test path
Dim objArgs
Set objArgs = wscript.Arguments
testPath = objArgs(0)
'Determining that the test does exist
Dim objFSO
Set objFSO = CreateObject("Scripting.FileSystemObject")
DoesFolderExist = objFSO.FolderExists(testPath)
Set objFSO = Nothing
If DoesFolderExist Then
Dim qtApp 'Declare the Application object variable
Dim qtTest 'Declare a Test object variable
Set qtApp = CreateObject("QuickTest.Application") 'Create the Application object
qtApp.Launch 'Start QuickTest
qtApp.Visible = True 'Make the QuickTest application visible
qtApp.Open testPath, False 'Open the test in read-only mode
Set qtTest = qtApp.Test
'Set qtResultsOpt = CreateObject("QuickTest.RunResultsOptions") ' Create the Run Results Options object
'qtResultsOpt.ResultsLocation = testResourcePath ' Specify the location to save the test results.
'qtTest.Run qtResultsOpt,True 'Run the test and wait until end of the test run
qtTest.Run 'Run the test
qtTest.Close 'Close the test
qtApp.Quit
Else
'Couldn't find the test folder. That's bad. Guess we'll have to report on how we couldn't find the test.
'Insert reporting mechanism here.
End If
使用上面的代码,这样的执行命令: cscript.exe "C:\RunThisTest.vbs" "L:\Test Path\The Test Itself\"
Answer 2:
多线程驱动程序工具可以用于执行脚本。
> mdrv.exe -usr "c:\test\foo.usr"
文章来源: How can I run a QTP test from the command line?