Active TopicsActive Topics  Display List of Forum MembersMemberlist  CalendarCalendar  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin


 One Stop Testing ForumTesting Tools @ OneStopTestingQuickTest Pro @ OneStopTesting

Message Icon Topic: Scheduling Script Execution and Continuously run

Post Reply Post New Topic
Author Message
Mithi25
Senior Member
Senior Member
Avatar

Joined: 23Jun2009
Online Status: Offline
Posts: 288
Quote Mithi25 Replybullet Topic: Scheduling Script Execution and Continuously run
    Posted: 30Nov2009 at 11:12pm
Once after successfully completing dry run of QTP scripts there is no need to monitor the script execution.

We can schedule the script execution during night time also.
Scheduling can be done easily using window task scheduler for starting the execution of QTP script automatically at a predefined time.

For doing scheduling, we need to create .vbs file.

The Important steps required for scheduling are,

- Create a Driver script which calls all the scripts one by one.
- Complete Dry run to make sure script will continue execution without any interruption. Add Recovery scenario for handling any unexpected pop-up window or any other inconsistent behavior of the application under test.
- Create a .vbs file which will be used for starting the QTP using Automation Object Model. Remember to add the code for keeping settings/options of the QTP so that the scheduler will open QTP with same settings.

you can refer the below sample vbscript code for creating the .vbs file to be called from the scheduler.


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

qtApp.Open "C:\Tests\Test1", True ' Open the test in read-only mode. Include your driver script here.
Set qtResultsOpt = CreateObject("QuickTest.RunResultsOptions") ' Create the Run Results Options object

qtResultsOpt.ResultsLocation = "C:\Tests\Test1\Res1" ' Set the results location
qtTest.Run qtResultsOpt ' Run the test


The complete code and details can be found in the QTP help file for Automation Object Model.

The next step is we should merge the code for QTP options/settings within this code.

The options/settings code can be easily generated automatically.

Click Tools->Options from QTP IDE to open the below screen.



Click "generate" in the above screen to automatically generate the code.

- Then add a task in windows scheduler for calling the .vbs file.

You can do it by using Schedule Task wizard from settings->control panel->Scheduled Tasks->Add Scheduled Task

Click "Browse" in the below screen of the wizard to set specify your .vbs file.


- Locking the system while running the script will affect the script running.So don't lock your machine while running the script. Anyway, you can add the below code at end of your .vbs file to lock the system automatically once after completing execution of the script.


Set obj = CreateObject("WScript.Shell")
sCmnd = "%windir%\SYSTEM32\rundll32.exe user32.dll,LockWorkStation"
obj.Run sCmnd, 0, False



Post Resume: Click here to Upload your Resume & Apply for Jobs

IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.047 seconds.
Vyom is an ISO 9001:2000 Certified Organization

© Vyom Technosoft Pvt. Ltd. All Rights Reserved.

Privacy Policy | Terms and Conditions
Job Interview Questions | Placement Papers | Free SMS | Freshers Jobs | MBA Forum | Learn SAP | Web Hosting