Wednesday, 16 September 2015

HOW TO RUN MULTIPLE TESTS IN QUICKTEST PROFESSIONAL (QTP) ?



Steps:

Declare the application object variable
Create the application object
Launch the qtp
Declare the array

Create the results run object
Open the tests
Assign the tests to variables
Execute the test by using run method
Close the qtp using close method
Relese the application object, teset object


Ans:
Set App = CreateObject("QuickTest.Application")
App.Launch
App.Visible = True

Dim QTP_Tests(3)
QTP_Tests(1) = "C:\Program Files\HP\QuickTest Professional\Tests\tr1"
QTP_Tests(2) = "C:\Program Files\HP\QuickTest Professional\Tests\tr2"
QTP_Tests(3) = "C:\Program Files\HP\QuickTest Professional\Tests\tr3"

'Creating the RunResultsOptions object. It is a collection of properties that indicate preferences for the run results. E.g. ResultsLocation property as used below which tells the path in which the run results will be stored.
Set res_obj = CreateObject("QuickTest.RunResultsOptions")

For i = 1 to UBound (QTP_Tests)
App.Open QTP_Tests(i), True
Set QTP_Test = App.Test
res_obj.ResultsLocation = QTP_Tests(i) & "\Res1" ' Set the results location
'Using the Run method. Run Method runs the open test or business component and creates results in the specified file or Quality Center path. A Boolean value - true or false can be set. Indicates whether the Test.Run statement waits until the end of the run before performing the next statement in the automation script. Default=True.
QTP_Test.Run res_obj, True
QTP_Test.Close
Next
App.Quit
Set res_obj = nothing
Set QTP_Test = nothing
Set App = nothing


SUBSCRIBE YOUTUBE CHANNEL FOR LATEST VIDEOS  
https://www.youtube.com/channel/UC1EmncBu2maDiHNMNNqxw9g

No comments:

Post a Comment