Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to run QTP scripts from command line prompt?
#1
Hi,

I have a requirement to run QTP from command line prompt using a .bat file. Could you please help me how to do this?

Thanks in advance.
Reply
#2
Assuming that we have a test script say "Test" on desktop... please include the below code in a vb file namely Test.vbs
Code:
Dim qtApp 'Declare the Application object variable Dim qtTest 'Declare a Test object variable Dim qtResultsOpt'Declare a Run Results Options object variable Set qtApp = CreateObject("QuickTest.Application")' Create the Application object qtApp.Launch' Start QuickTest qtApp.Visible = True' Make the QuickTest application visible qtApp.Open "C:\Documents and Settings\testingsvs_qa\Desktop\Test",True' Open the test in read-only mode Set qtTest = qtApp.Test qtTest.Run ' Run the test WScript.StdOut.Write "The Run Status is:" & qtTest.LastRunResults.Status' Check the results of the 'test run qtTest.Close' Close the test Set qtTest = Nothing' Release the Test object Set qtApp = Nothing' Release the Application object

Now in order to execute QTP script from command line we have to execute the above created vbs file from command prompt which will in turn launch QTP, open the script, run it and will display the result in command prompt only. Open command prompt and write following code: And press enter

C:\Documents and Settings\Ravi_Gajul\Desktop>cscript Test.vbs
Note : C:\Documents and Settings\Ravi_Gajul\Desktop is the location of Test.vbs..update this accordingly

If the script passes the result is declared in command prompt as follows:
The Run Status is: Passed

Regards,
Ravi



Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to catch the script execution when QTP scripts are executed from command line Sreeni.lutukurthy 0 3,348 03-19-2015, 05:55 PM
Last Post: Sreeni.lutukurthy
Wink How to read text in command prompt using QTP Sourabh146 1 7,102 11-30-2013, 11:02 AM
Last Post: ravi.gajul
  Is it possible to run the QTP scripts on machine with out QTP is installed? kalyan_srirangam 2 4,091 10-21-2013, 07:19 PM
Last Post: kalyan_srirangam
  Can any of the line in notepad file be appended/updated/modified via QTP(VBScript)? rookie_automator 1 2,988 08-22-2013, 07:13 AM
Last Post: basanth27
  Clicking command button in accesss form mark_cielos24@yahoo.com 1 3,859 05-07-2013, 10:52 PM
Last Post: agarwl.anurag

Forum Jump:


Users browsing this thread: 1 Guest(s)