UFT execution and pause from vbscript file UFT GUI

  • Questions
  • UFT execution and pause from vbscript file UFT GUI
Question ID: 108025
1
0

I’ve written a couple of small vbscript files. The first one launches UFT and runs a script to completion then quits UFT. That code is listed here:

——————————————–
Dim uftApp
Dim WshShell

Set uftApp = CreateObject("QuickTest.Application")

If NOT uftApp.Launched Then
uftApp.Launch
End if

uftApp.Visible = True
uftApp.WindowState = "Minimized"

uftApp.Open "C:\\Users\\zzz\\Desktop\\UFT Repository\\mytest", False

uftApp.Test.Run

uftApp.Test.Close

uftApp.Quit

Set uftApp = Nothing

——————————————–

And then I have another vbs file that I use to pause execution. I’ve created a shortcut for this vbs file and assigned shortcut keys of "cntl + alt + p". I also have another vbs file "continue.vbs" which simply resumes execution but I won’t list that here.
——————————————–
Dim qtApp
Set qtApp = CreateObject("QuickTest.Application")
qtApp.Test.Pause
Set qtApp = Nothing
——————————————–
When I launch UFT manually myself I am able to use the pause.vbs file with the shortcut and it works great! However, when I launch UFT from the above vbs file I am not able to use the pause.vbs file at all.

Can someone there explain to me what I’m doing incorrectly? Is there a better way to achieve this?

Marked as spam
Posted by (Questions: 22, Answers: 6)
Asked on December 14, 2017 2:39 pm
65 views
Answers (1)
0
Private answer

Looking up the pause method in the UFT Automation Object Model Reference for GUI Testing it has the following:

**Important Information**
To make it possible to pause a run session from an automation script, you
must set the WaitOnReturn argument of the Test.Run method to False. If you
choose to do this, make sure that all automation steps following the Run
statement can run successfully even before the UFT run session ends.

Please make sure the WaitOnReturn argurment is set and re test. For more details the ''UFT Automation Object Model Reference for GUI Testing'' can be found at Start > HP Software > HP Unified Functional Testing > Documentation > ''UFT Automation Object Model Reference for GUI Testing''.

The run has three optional arguments and the WaitOnReturn is the one you need to set to false per the notes of the 'UFT Automation Object Model Reference for GUI Testing' help.

object.Run [ResultsOptions], [WaitOnReturn], [Parameters]

From the example in the 'UFT Automation Object Model Reference for GUI Testing' help it looks like the following will work.

qtApp.Test.Run , True, rtParams

As for your code example I do not think the second comma is required but I would try the example both ways.

Your code

uftApp.Test.Run ,False,

Recommendation
uftApp.Test.Run ,False

Marked as spam
Posted by (Questions: 2, Answers: 98)
Answered on December 14, 2017 2:39 pm