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

19,085

Solution 1

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

Solution 2

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.

Share:
19,085
Ziwdigforbugs
Author by

Ziwdigforbugs

Updated on June 15, 2022

Comments

  • Ziwdigforbugs
    Ziwdigforbugs about 2 years

    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

  • Pixie
    Pixie almost 10 years
    Giving praise is not an answer ;)
  • Geddon
    Geddon over 9 years
    what are the exact steps you took to changing the user type to interactive?