本文介绍了通过批处理文件远程启动UFT(QTP)测试.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了许多UFT 12(ex QTP)测试,并且还创建了一个批处理文件以运行这些测试.

I have created a bunch of UFT 12 (ex QTP) tests and I have also created a batch file in order to run theses tests.

当我在本地运行批处理文件时,测试运行正常.

When I run the batch file in local the tests are running fine.

这是我使用的脚本:

 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

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

Now I am trying to execute these batch file remotely through a Job that launch it.I am facing two issue :

1st:我有一个Interactive Services Detection提示,带有一个弹出框,我应该点击查看消息以切换到另一个屏幕,这对我来说是个问题,因为我希望UFT自动启动而没有任何提示用户互动.

1st : I am having a Interactive Services Detection prompt with a pop up box where I should click on view the message in order to switch to another screen, this is an issue for me as I want UFT to be launched automatically without any user interaction.

第二个问题:即使我在服务交互弹出窗口中单击查看消息,也无法启动UFT.
我在互联网上进行了搜索,发现了一个建议先打开UFT的建议,因此我在上面脚本的顶部添加了该代码段:

2nd Issue : Using this script UFT is not starting even when I click on view message in the service interaction pop up.
I have searched in the internet and I have found a suggestion to open UFT first so I have added this snippet on the top of the script above :

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,但睾丸未启动.

With this script UFT is launched after I click on the Interactive Services Detection message but the testes are not starting.

因此,我要回答的问题是如何避免进行交互式服务检测并直接启动UFT,以及如何在UFT启动后立即开始进行测试.

So to resume my question is how can I avoid the Interactive Services Detection and launch UFT directly and how I can get tests starting once UFT is launched.

谢谢Zied

推荐答案

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

Thanks TheBlastOne for your comment, indeed I looked at the docs and it turned out to be a DCOM config issue, I have changed the user type to interactive which has solved the problem.

谢谢Zied

这篇关于通过批处理文件远程启动UFT(QTP)测试.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 18:49