Batch file 通过批处理文件远程启动UFT(QTP)测试。
我已经创建了一系列UFT 12(ex QTP)测试,并且还创建了一个批处理文件来运行这些测试 当我在本地运行批处理文件时,测试运行正常 以下是我使用的脚本:Batch file 通过批处理文件远程启动UFT(QTP)测试。,batch-file,qtp,hp-uft,Batch File,Qtp,Hp Uft,我已经创建了一系列UFT 12(ex QTP)测试,并且还创建了一个批处理文件来运行这些测试 当我在本地运行批处理文件时,测试运行正常 以下是我使用的脚本: Set qtpApp = CreateObject("QuickTest.Application") Set fsObj = CreateObject("Scripting.FileSystemObject") Set qtpResObj = CreateObject ("QuickTest.RunResultsOptions")
Set qtpApp = CreateObject("QuickTest.Application")
Set fsObj = CreateObject("Scripting.FileSystemObject")
Set qtpResObj = CreateObject ("QuickTest.RunResultsOptions")
qtpApp.Launch
qtpApp.Visible= true
sfolderPath = "C:\QA\ManagerForOracleDB"
Set mainFolderObj = fsObj.GetFolder (sfolderPath)
Set testSubFolders = mainFolderObj.SubFolders
sPath = "C:\&formatDate&\"
For each folderobj in testSubFolders
chkfolderobj = folderObj.Path & "\Action0"
if ( fsObj.FolderExists(chkfolderobj)) then 'The Folder is a QTP test folder'
qtpApp.Open folderObj.Path, True, False
sResultFolderPath = sPath&folderObj.Name & "\Res" 'Set the results location'
qtpResObj.ResultsLocation = sfolderPath
qtpApp.Test.Run qtpResObj , True
strResult = qtpApp.Test.LastRunResults.Status
WScript.echo strResult
qtpApp.Test.Close
End if
Next
'Send Mail
qtpApp.Quit
'Release the file System objects
Set testSubFolders = Nothing
Set mainFolderObj = Nothing
Set fsObj = Nothing
Set qtpResObj= Nothing
Function formatDate ()
str= now ()
str=replace(str,"/","")
str=replace(str,":","")
str=replace(str," ","")
formatDate = mid (str,1,len(str-2))
End Function
现在,我正试图通过启动批处理文件的作业远程执行这些批处理文件。
我面临两个问题:
第一:我有一个带有弹出框的交互式服务检测提示,在弹出框中我应该单击查看消息以切换到另一个屏幕,这对我来说是一个问题,因为我希望UFT在没有任何用户交互的情况下自动启动
第二个问题:即使我单击服务交互弹出窗口中的查看消息,使用此脚本UFT也不会启动。我在互联网上搜索了一下,发现了一个建议,建议先打开UFT,所以我在上面的脚本顶部添加了这个片段:
dim commandLine, WshShell
' Define command line
commandLine = """C:\Program Files (x86)\HP\Unified Functional Testing\bin\UFT.exe"""
Set WshShell = CreateObject("WScript.Shell")
' Start QTP via command line
WshShell.Run commandLine, 8, true
' Wait a while until QTP is loaded (here 10 secs)
WScript.Sleep 10000
set WshShell=nothing
在这个脚本中,UFT是在我点击InteractiveServicesDetection消息后启动的,但是测试没有启动
因此,我的问题是如何避免交互式服务检测并直接启动UFT,以及如何在启动UFT后启动测试
谢谢
Zied感谢TheBlastOne的评论,事实上,我查看了文档,结果发现这是一个DCOM配置问题,我已将用户类型更改为interactive,从而解决了问题 谢谢
Zied以下是如何将DCOM配置中的用户更改为交互式的
文档中有关于使用自动化接口运行测试的示例。交互式服务检测让我相信UFT是使用不同的用户安装的,而不是使用执行WSH脚本的用户,对吗?然后我会看看这些文档。UFT是用不同的用户安装的,但我已经用与现在启动作业的用户相同的用户重新安装了它,但仍然面临交互服务问题。表扬不是答案;)将用户类型更改为“交互式”的具体步骤是什么?