Monday, May 18, 2009

How To Run QTP Scripts at Scheduled Time?

I have gathered this information from learnqtp.com by Ankur.

There can be situations when you need to schedule your QTP scripts so that they can run when you are not present in front of you PC. I will show you a demo below -

1) Create a .vbs fild to launch QTP with requiresd settings, add-ins etc.\\
Here is a sample vbs code

Set App = CreateObject("QuickTest.Application")

App.Launch

App.Visible = True

App.WindowState = "Maximized"

App.ActivateView "ExpertView"

App.open "C:\Program Files\Mercury Interactive

\QuickTest Professional\Tests\Test1", False

'Opens the test in editable mode

2) OK, for the first timers. Create a sample QTP test and save it as Test1 at the location above. Copy the code into notepad and name the file as testing.vbs

3) Now we will automate the opening of vbs file through windows scheduyler. Go to Start > Control Panel > Schedule Tasks > Click Add Schedule Tasks Click Next on the Screen

4) Click Browse and select the .vbs file you just created. You will ge this screen.

image

5) Give a name to the task and select the frequence for performing the
given tasks. For this demo we will select "One time only"

image

6) Select Start Time and Start Date. For this demo, select Start Time as current time+5 mins and Start date as today date.
7) Next Screen Enter "UserNAme", "Password" and "Confirm Password"
Click Next and you should get this screen.

image











8) Click on Finish, you're done.


7 comments:

Anil said...

Hello RAJAPUTRA,
thanks for the sample script.
I have another follow up question though. The script you have wrote can run one script but I want to run Multiple script((lets say 5 script) ) one after another? IS it possible? How can it be done? Please looking for answer and thanks in advance.

Anil said...

Hello RAJAPUTRA,
thanks for the sample script.
I have another follow up question though. The script you have wrote can run one script but I want to run Multiple script((lets say 5 script) ) one after another? IS it possible? How can it be done? Please looking for answer and thanks in advance.

digitalarif said...

You need to design a master script. and In that script call other reusable actions. Give master script path under .vbs file

Anonymous said...

Hi,
This script only opens the script buit does not run it....What doi add to run it ???

Anonymous said...

hi
it is anice piece of information it helped me a lot .one scinario i want to run ascript on 14:00hrsIST to capture the client request order my question is does it affect my current run session because the script you provide opens qtp and on my machine qtp is already opened because i am supposed to run other scripts at that time

Rajaputra said...

U can. For that you have to design ur driver script such that, it will run all flagged scripts

RAJAPUTRA said...

yes. it will affect your current session. This technique will be used whenever there is build deployed in QA environment and want to do smoke testing, just schedule a time (you can get from developers at wht time build will be ready in QA) do a smoke test.

About Me

My photo
Hi all,I am Arun Singh Rajaputra. I am working as a Project Lead in a reputed organization in Hyderabad, AP, India. I have little bit knowledge on Quick Test Professional and like to share my knowledge to all through this blog.

Subscribe to get updates on this blog

Enter your email address:

NOTE

Some of the posts posted in this blog are collected and most of them have been prepared by me. If any one have objections regarding any copied posts. Please mail me so that I can take a necessary action on that post.