Close

June 29, 2013

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 NaveenKumar Namachivayam

Hi there! is a passionate and experienced Performance Test Analyst based in Chicago, USA with skill sets in Manual Testing, Test Automation, Performance Testing, and Test Estimation. He loves to learn and experiment new trends and models in Software Testing. Please stop by at his personal blogs: Excel Blog, DealsBrook, NaveenKumarN.in, and Affiliate Insights blog and Software Testing Memes.

Leave a Reply

Your email address will not be published. Required fields are marked *