QTP : executing test from commandline
I am trying to run the QTP from commandline. I managed to execute QTP through commandline but I got as far as opening the QTP application and unable to start the specific test. I found in one of the posts that I need to create the vbs file which I can execute through the batch file. I need to execute specific test. I am not sure what exactly needs to be included in the vbs file since each test folder contains lots of different files.
Can anyone help me found solution or post some working sample code?
THANKS for any suggestions.
Re: QTP : executing test from commandline
Simple.. Just type the filename (vbscript name) without extension (.vbs) in the commandprompt.
(u have to type in the directoty where .vbs file is stored)
for example,type this script in notepad and save (login.vbs) it in "c:/"
[COLOR=red]systemutil.run "c:\program files\mercury interactive\quicktest professional\samples\flight\app\flight4a.exe[/COLOR]
[COLOR=red]dialog("text:=Login").activate [/COLOR]
[COLOR=red]dialog("text:=Lgin").winedit("attached text:=Agent Name:").set "rajaputra"[/COLOR]
[COLOR=red]dialog("text:=Login").winedit("attached text:=Password:").set "mercury" [/COLOR]
[COLOR=red]dialog("text:=Login").winbutton("text:=OK").click[/COLOR]
save the notepad as login.vbs in c:/ and close notepad
open commandprompt and type [COLOR="Blue"]login[/COLOR] in c:/
That is. I think U got it. Reply me if u r.
Re: QTP : executing test from commandline
You can use the following piece of code
Set qtApp= CreateObject("QuickTest.Application")
qtApp.Launch
qtApp.Visible = True
'Set objExplorer = CreateObject("InternetExplorer.Application")
'objExplorer.Navigate "GIVE URL HERE"
qtApp.Open "C:\Automation\Scripts\" 'PATH WITH SCRIPT NAME HERE
qtApp.Test.Run
you can call open and run as many times you want and call many script which will work as a batch run.
Thanks,
Kunal.