Launching UFT ( QTP ) Tests remotely through a batch file.

我的未来我决定 提交于 2019-12-05 01:50:00

问题


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.

Here is the script I use :

 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 : 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.

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  

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

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.

Thanks Zied


回答1:


Here is how you change the user in the DCOM config to interactive.

  1. On the computer where you want to run the automation script, choose Start > Run. The Run dialog box opens.
  2. Enter dcomcnfg and click OK. The Distributed COM Configuration Properties dialog box or the Component Services window opens (depending on your operating system) and displays the list of COM applications available on the computer.
  3. Select QuickTest Professional Automation from the list and open the Properties dialog box for the application. (Click the Properties button or right-click and chooseProperties, depending on your operating system.)

  4. In the QuickTest Professional Automation Properties dialog box, click the Identity tab and select the interactive user option.




回答2:


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.

Thanks Zied



来源:https://stackoverflow.com/questions/24362168/launching-uft-qtp-tests-remotely-through-a-batch-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!