How to launch QTP using VB Script?

We will see how to launch QTP using simple VB Script snippet. First we need to declare an object using below syntax:

Dim qtpApp as QuickTest.Application
Set qtpApp=new QuickTest.Application
or
Set qtpApp = CreateObject("QuickTest.Application")
  • To check whether QTP is already open, use Application.Launched or Application.GetStatus
  • To return all the addins collection object, use Application.Addins
  • To retrieve associated add-ins (Application.GetAssociatedAddinsForTest)
  • To set the add-ins you want to load when QuickTest starts (Application.SetActiveAddins)
  • To instruct QuickTest whether to open in visible or minimized mode (Application.Visible)
  • To specify which view (Keyword or Expert View) to display when QuickTest opens, if opening QuickTest in Visible mode (Application.ActivateView)
  • To instruct QuickTest to start and open a new, blank test or component (Application.New or Application.NewBusinessComponent)
  • To instruct QuickTest to start and open a specified, existing test or component (Application.Open or Application.OpenBusinessComponent)
  • To quit QTP application, use qtpApp.Quit and Set qtpApp = nothing
'************************************************************************************************************************
‘Below example configures QuickTest views and panes '************************************************************************************************************************
Dim qtpApp 'As QuickTest.Application ' Declare the Application object variable
Set qtpApp = CreateObject("QuickTest.Application") ' Create the Application object
qtpApp.Launch ' Start QuickTest
qtpApp.ActivateView "ExpertView" ' Display the Expert View
qtpApp.ShowPaneScreen "ActiveScreen", True ' Display the Active Screen pane
qtpApp.ShowPaneScreen "DataTable", False ' Hide the Data Table pane
qtpApp.ShowPaneScreen "DebugViewer", True ' Display the Debug Viewer pane
qtpApp.WindowState = "Maximized" ' Maximize the QuickTest window
qtpApp.Visible = True ' Make the QuickTest window visible

Set qtpApp = Nothing ' Release the Application object

Thanks for visiting QAInsights! Check out our new portal Testifications.com to get updates on Software Testing related certifications. We’re always posting interesting articles on QAInsights. I request you to subscribe so you don’t miss out anything. Searching for QA Jobs Openings, check it at www.QAJobOpenings.com

Want to start a blog like this, please visit SpidyDomain to buy cheap web hosting and register domain.

Subscribe to our QAInsights YouTube Channel

Subscribe our free weekly newsletter or Google feeds

About the Author

2 thoughts on “How to launch QTP using VB Script?”

  1. This code not working for me, I am using UFT 14. its showing error in line 3.
    I tried replacing the Quicktest with UFT. still getting issue.
    I have set the Environment variable for UFT.

    Reply

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Hamster - Launch JMeter Recent Test Plans SwiftlyDownload for free
+
Share via
Copy link