Prepare for your Next Interview
This is a discussion on about qtp within the QTP forums, part of the Software Testing category; can i run my script by command prompt with out intalling qtp at one side?...
|
|||
|
Re: about qtp
hi,
1)create a vbs file 2)add this code : Dim App Set App = CreateObject("QuickTest.Application") App.Launch App.Visible = True ' can be True or false ' Load an .ini file with the user-defined parameters. App.Test.Environment.LoadFromFile "C:\Test_Params\environment_file1.ini" ' Declare an array with the paths and names of the tests. dim testArray(3) testArray(1) = "C:\Program Files\Mercury Interactive\QuickTest Professional\Tests\mytest" testArray(2) = "C:\Program Files\Mercury Interactive\QuickTest Professional\Tests\mytest2" testArray(3) = "C:\Program Files\Mercury Interactive\QuickTest Professional\Tests\mytest3" Set qtResultsObj = CreateObject("QuickTest.RunResultsOptions") ' Loop through all the tests in the testArray. for i = 1 to UBound (testArray) ' Open the test in QuickTest Professional. App.Open testArray(i), True ' Get the test object. Set qtTest = App.Test ' Set the test results options. Here the location for the test results will be set. qtResultsObj.ResultsLocation = testArray(i) & "\Res1" ' Set the results location 'Execute the test. Instruct QuickTest Professional to wait for the test to finish executing. ' This statement specifies a test results location. qtTest.Run qtResultsObj, True ' Run the script using the default test results options. qtTest.Run ' Close the test. qtTest.Close 'Close the test next ' Close QuickTest Professional. App.Quit ' Release the created objects. set qtResultsObj = nothing set qtTest = nothing set App = nothing 3)save the vbs file and close it.(c:\work\runQTP.vbs) 4)goes to the remote machine and open the command line. 5)write the path of the qtp machine and add ""c:\work\runQTP.vbs" 6) this should work let me know if it's working for you. Yan , Tel-Aviv Last edited by yan : 02-16-2007 at 07:06 PM. |