Saturday, August 20, 2011

QTP AOM - Open QTP and run a script in QTP using AOM

Dim qtp, ts, tres, op, oprun

set qtp = createobject("Quicktest.Application")

set tres = createobject("QuickTest.RunResultsOptions")

qtp.Launch 'for launching QTP

qtp.Visible= true 'to make QTP visible

set op = qtp.Options

set oprun = op.Run

oprun.ViewResults = true 'to view the results once script is executed

if qtp.GetStatus = "Ready" then

qtp.Open "D:\QTP\sampletest",true 'open the test from the location mentioned

set ts = qtp.Test

tres.ResultsLocation = "D:\QTP\sampletest\Res" 'results location

ts.Run tres 'run the test

if ts.LastRunResults.Status = "Passed" then

msgbox "Test run is successful"

else

msgbox "Test run failed, analyze and post the defect"

end if

ts.close

else

msgbox "QTP is not ready"

end if

qtp.Quit

set qtp = nothing

No comments:

Post a Comment