Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Run a created project at a determinate time
#1
Solved: 11 Years, 3 Months, 3 Weeks ago
Hi!

I must create a new test project with QTP where all recorded actions must be run at a determinate time (for example 15h).
Is possible to configure QTP to run my project automatically at a determinate time?

Thanks
Reply
#2
Solved: 11 Years, 3 Months, 3 Weeks ago
Ya its possible.

Create a file named "Scheduler.vbs" and copy paste the code below, give proper path of the test script and save it.

* Go to Start -> Control Panel -> Scheduled Tasks
* Click on "Add Scheduled Task"
* In the "Scheduled task wizard" click "Next"
* Click on "Browse..." and select the "Scheduler.vbs" script you have created and click "Next"
* In the next screen, give a name for your schedule, select the frequency(e.g.: daily) and click "Next"
* Set the rest of the options in the next screen, click on "Next" and enter the login details along with password
* In the last screen, check the "Open advanced properties....." checkbox and click "Finish"

* Go to the "Schedule" tab and enter the time in which you want to run the script.
Work around the options, you can also schedule the script to run once in an hour.

***Note: For the script to run properly, the machine should not be locked. To do this,
Right click on the desktop and select "properties"
Go to "Screen saver" tab and disable the screensaver.

If the screen save option is disabled, it means that the automation lock is guided by the "Group policy". Get in touch with your clients and get them create a generic id which will not get locked automatically.

Alternatively, you can download "Caffeine" from the url below. It will send a key stroke every 59 seconds which will keep your desktop active. (Note: This will not work in remote machines).

http://www.zhornsoftware.co.uk/caffeine/

---
Code:
ExecuteTest("D:\MyQTPScript\Driver")
Public Sub ExecuteTest(TestPath)

Dim qtApp 'As QuickTest.Application ' Declare the Application object variable
Dim qtTest 'As QuickTest.Test ' Declare a Test object variable
Dim qtResultsOpt 'As QuickTest.RunResultsOptions ' Declare a Run Results Options object variable

Set qtApp = CreateObject("QuickTest.Application") ' Create the Application object
qtApp.Launch ' Start QuickTest
qtApp.Visible = True ' Make the QuickTest application visible

' Set QuickTest run options
qtApp.Options.Run.ImageCaptureForTestResults = "OnError"
qtApp.Options.Run.RunMode = "Fast"
qtApp.Options.Run.ViewResults = True

'This will Open a script
qtApp.Open TestPath , True ' Open the test in read-only mode


' set run settings for the test
Set qtTest = qtApp.Test
qtTest.Settings.Run.IterationMode = "rngIterations" '
qtTest.Settings.Run.StartIteration = 1
qtTest.Settings.Run.EndIteration = 1
qtTest.Settings.Run.OnError = "NextStep" ' Instruct QuickTest to perform next step when error occurs

'For Viewing Results
'Set qtResultsOpt = CreateObject("QuickTest.RunResultsOptions") ' Create the Run Results Options object
'qtResultsOpt.ResultsLocation = "D:\EESS\Results" ' Set the results location
'qtTest.Run qtResultsOpt ' Run the test
'qtApp.Options.Run.ViewResults = True

qtTest.Run

'Close QTP
qtTest.Close ' Close the test
qtApp.Quit 'Close QTP

'Set the options to nothing
'Set qtResultsOpt = Nothing ' Release the Run Results Options object
Set qtTest = Nothing ' Release the Test object
Set qtApp = Nothing ' Release the Application object

End Sub


---

Let me know in case of any doubts.

Thanks,
Elango
Reply
#3
Solved: 11 Years, 3 Months, 3 Weeks ago
Thanks for the information that you have provided me. This information is really detailed and useful.

I've implemented the script under my test conditions and it really works.

We are in contact for questions.

Best regards!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  QTP not recogonising object during run time Lavanya N 2 3,723 10-28-2015, 12:46 PM
Last Post: vinod123
  Writing to Run time data table Neetha 5 12,163 08-27-2015, 10:18 AM
Last Post: supputuri
  QTP Takes Long time to Run prasaad44 4 4,876 04-10-2014, 01:53 AM
Last Post: prasaad44
  How to choose Framework for a project AshokReddy 1 2,724 01-15-2014, 03:41 PM
Last Post: madhavanr
Exclamation Getting run time error while executing the QTP script in command prompt. vishruth143 1 5,643 07-15-2013, 05:41 PM
Last Post: vinod123

Forum Jump:


Users browsing this thread: 1 Guest(s)