Thursday, 20 February 2014

How to schedule QTP script execution at night?

Well - Many a times you need to schedule the test execution with QTP at night.

I am going to explain how you can write a vbscript to run QTP test at specific period of time. You can copy below code and store it in sample vbscript file say qtptask.vbs Please do not forget to change the path of the test to execute at the first line in below code.

Now go to windows scheduler through control panel and create a new task. Give the path of the vbs file you created and set the specific time at which you want to execute the QTP scripts.

That's it. Now you can go home and relax. Your QTP scripts will run automatically at the time you specified in task.

Example to launch QTP automatically

testpath = "C:\sample-scheduled-test"

'Create the QTP Application object
Set qtApp = CreateObject("QuickTest.Application") 
qtApp.Launch 

'Make the qtp application visible
qtApp.Visible = True

'open the test you want to run 
qtApp.Open testpath , True 

'start executing the test
qtApp.Test.Run

'close the test
qtApp.Test.Close

'quit the QTP application
qtApp.quit

Please give your inputs, suggestions, feedback to Us about above QTP topic. We value your thoughts.

No comments:

Post a Comment

Please Leave your reply. We value your feedback and inputs

Best QTP Books

Everything About QTP

Hello Friends,
You can find QTP study material, Multiple choice questions (mcq), QTP question bank, QTP question papers, QTP notes, QTP questionnaire, scenario based QTP interview questions, QTP tutorial and QTP training on this site.

If you are a fresher or experienced QTP professional with (1/2/3/4) years of experience, this blog is just for you.