通过批处理文件远程启动 UFT ( QTP ) 测试。

Ziw*_*ugs 5 batch-file qtp hp-uft

我创建了一堆 UFT 12(前 QTP)测试,我还创建了一个批处理文件来运行这些测试。

当我在本地运行批处理文件时,测试运行良好。

这是我使用的脚本:

 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
Run Code Online (Sandbox Code Playgroud)

现在我正在尝试通过启动它的作业远程执行这些批处理文件。我面临两个问题:

第一:我有一个带有弹出框的交互式服务检测提示,我应该在其中单击查看消息以切换到另一个屏幕,这对我来说是一个问题,因为我希望 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  
Run Code Online (Sandbox Code Playgroud)

使用此脚本 UFT 在我单击交互式服务检测消息后启动,但睾丸未启动。

因此,我的问题是如何避免交互式服务检测并直接启动 UFT,以及如何在启动 UFT 后开始测试。

谢谢齐德

Ged*_*don 5

以下是将 DCOM 配置中的用户更改为交互式用户的方法。

  1. 在要运行自动化脚本的计算机上,选择“开始”>“运行”。运行对话框打开。
  2. 输入 dcomcnfg 并单击确定。“分布式 COM 配置属性”对话框或“组件服务”窗口将打开(取决于您的操作系统)并显示计算机上可用的 COM 应用程序列表。
  3. 从列表中选择 QuickTest Professional Automation 并打开应用程序的“属性”对话框。(单击“属性”按钮或右键单击并选择“属性”,具体取决于您的操作系统。)

  4. 在 QuickTest Professional 自动化属性对话框中,单击身份选项卡并选择交互式用户选项。


Ziw*_*ugs -4

感谢 TheBlastOne 的评论,确实我查看了文档,结果发现这是一个 DCOM 配置问题,我已将用户类型更改为交互式,这解决了问题。

谢谢齐德

  • 给予赞扬并不是答案;) (2认同)