Micro Focus QTP (UFT) Forums

Full Version: How to schedule regular UFT runs
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi Gurus,
Do any of you guys have any ideas or can point me to some good documentation which will allow me to schedule runs of UFT tests on a Win7 or Win8 operating system? The idea at our company is to have the tests run overnight so we can detect any regressions made in the software product.

Cheers,
Code:
Dim App
Set App = CreateObject("QuickTest.Application")
App.Launch
App.Visible = True
Dim QTP_Tests(2)
'Location of the test script
QTP_Tests(1) = "C:\Tests\paypage hits"
'Creating the RunResultsOptions object. It is a collection of properties that indicate preferences for the run results. E.g. ResultsLocation property as used below which tells the path in which the run results will be stored.
Set res_obj = CreateObject("QuickTest.RunResultsOptions")
For i = 1 to UBound (QTP_Tests)
App.Open QTP_Tests(i), True
Set QTP_Test = App.Test
res_obj.ResultsLocation = QTP_Tests(i) & "\Res25" ' Set the results location
'Using the Run method. Run Method runs the open test or business component and creates results in the specified file or Quality Center path. A Boolean value - true or false can be set. Indicates whether the Test.Run statement waits until the end of the run before performing the next statement in the automation script. Default=True.
QTP_Test.Run res_obj, True
QTP_Test.Close
Next
App.Quit
Set res_obj = nothing
Set QTP_Test = nothing
Set App = nothing
Save the script in .vbs format. After that open control panel select Scheduled Tasks and click on the Add schedule task click on next and click browse and select the script and proceed with next option displayed while using the wizard