Run QTP From Command Prompt

Run QTP From Command Prompt

Dim qtApp ‘As QuickTest.Application ‘ Declare the application object variable
Set qtApp = CreateObject(“QuickTest.Application”) ‘ Create the application object

qtApp.SetActiveAddins Array(“Web”) ‘ Activate the Web Add-in
qtApp.Launch ‘ Start QuickTest
qtApp.Visible = True ‘ Make the QuickTest application visible

‘ Set QuickTest run options
qtApp.Options.Run.CaptureForTestResults = “ALL”
qtApp.Options.Run.RunMode = “Fast”
qtApp.Options.Run.ViewResults = False

qtApp.Open “C:TestsTest1″, True ‘ Open the test in read-only mode

‘ set run settings for the test
Set qtTest = qtApp.Test
qtTest.Settings.Run.IterationMode = “rngIterations” ‘ Run only iterations 2 to 4
qtTest.Settings.Run.StartIteration = 2
qtTest.Settings.Run.EndIteration = 4

Set qtResultsOpt = CreateObject(“QuickTest.RunResultsOptions”) ‘ Create the Run Results Options object
qtResultsOpt.ResultsLocation = “C:TestsTest1Res1″ ‘ Set the results location

qtTest.Run qtResultsOpt ‘ Run the test

MsgBox qtTest.LastRunResults.Status ‘ Check the results of the test run
qtTest.Close ‘ Close the test

Set qtResultsOpt = Nothing ‘ Release the Run Results Options object
Set qtTest = Nothing ‘ Release the Test object

Set qtApp = Nothing ‘ Release the Application object

Display Pop Wait for Some time & Display Another
Set WshShell = CreateObject(“WScript.Shell”)
WshShell.Popup “Some text”, TimeOut, “Some Title”