This article discusses how to run QTP scripts in the Scheduled Tasks item in Control Panel. By this method you can schedule individual script or multiple scripts and scripts will run automatically (even when you not at desk):
1. Create a sample QTP Test script. Save it as Testscript in the following location:
C:\Documents and Settings\skalra\Desktop\testscript
2. Create a .vbs file in notepad or in any other script editor to launch QTP with required settings, add-ins etc:
Here is a sample VB script code:
qtApp.Visible = True
qtApp.Open "C:\Documents and Settings\skalra\Desktop\testscript" 'this is the location of test scripts
Set qtTest = qtApp.Test
Set objResultsOptions = CreateObject("QuickTest.RunResultsOptions")
objResultsOptions.ResultsLocation = strPathname & getTimestamp() 'Suppose you have a function that returns you the timestamp
Copy the code into notepad and save the file as QTPschedule1.vbs
3. Schedule the QTP:
– Go to Windows “Control Panel” -> “Scheduled Tasks”.
– Click on “Add Scheduled Task” in the “Scheduled Tasks”
– This will start the “Scheduled Tasks Wizard”.
– browse the .vbs file where u placed.
– after selecting, click on the proceed button & select the schedule as u want.
Opening scheduled tasks to modify them
To modify a scheduled task, click Start, click All Programs, point to Accessories, point to System Tools, and then click Scheduled Tasks. The Scheduled Tasks window opens so that you can modify the settings.
Stopping and pausing scheduled tasks
* To stop a running task, right-click the task in the Scheduled Tasks window, and then click End Task. It may take a moment or two for the task to stop. To restart the task, right-click the task and then click Run.
* To pause the task scheduler so that no tasks run until you want them to, click Pause Task Scheduler on the Advanced menu. To permit tasks to run again, click Continue Task Scheduler on the Advanced menu.
NOTE: If you click Pause, the task will run at its next scheduled time.