2014-06-23 57 views
4

我已经创建了一堆UFT 12(ex QTP)测试,并且我还创建了一个批处理文件以运行这些测试。通过批处理文件远程启动UFT(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 

现在我试图通过推出其作业远程执行这些批处理文件。 我面临两个问题:

第一:我有一个交互式服务检测提示与弹出框,我应该点击查看消息以切换到另一个屏幕,这对我来说是一个问题,因为我希望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启动后,我点击交互式服务检测消息但睾丸未启动。

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

感谢 Zied

+0

有关使用自动化接口运行测试的文档中有示例。交互式服务检测功能让我相信UFT是使用不同于执行WSH脚本的用户安装的,对吗? – TheBlastOne

+0

然后我会看看这些文档。UFT安装了一个不同的用户,但我已经用与现在启动作业的用户相同的用户重新安装了它,但仍面临着交互式服务问题。 – Ziwdigforbugs

回答

-4

感谢TheBlastOne的评论,事实上,我看了看文档,它原来是一个DCOM配置的问题,我已经改变了用户类型已经解决了这个问题互动。

感谢 Zied

+2

给予赞美并不是答案;) – Pixie

+0

您将用户类型更改为交互式具体步骤是什么? – Geddon

4

这里是你如何更改DCOM配置交互式用户。

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

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