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
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.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
No comments:
Post a Comment
Please Leave your reply. We value your feedback and inputs