We received couple of queries on QTP AOM. In this post we simplified the QTP AOM, so that a newbie in QTP can also understand what is Automation Object Model and how it works.
Automation is a technology through which we can access software objects inside one application from other applications. This can be done by VB scripting, VC++, Visual Basic, Javascript etc. So automation helps in managing the functionality of an application programmatically.

Object Model – Every software system consists of some objects & classes. System works because of these objects. And Object model is nothing but an object model is a structural representation of objects and classes. An object model defines a set of classes and interfaces, together with their properties, methods and events, and their relationships.

QTP Automation Object Model – Concluding from above two definitions – We can access QTP objects and control/managing its functionality by VB script. For example –

  • We can open QTP with the help of vb script.
  • We can run QTP tests without opening QTP manually. By vbscript, we can invoke QTP and define the testes which need to be executed.
  • We can set iterations for the execution of the test script and can also pass parameters.

All the above statements/conditions are defined in a vbscript. VBscript opens QTP and manages above functionality.

How this can be done? How VBscript controls QTP?
QTP provides an interface (object model), through which we can automate QTP itself by vbscript. By this we can automate tasks like – Run and configure QTP, Run scripts etc.
See below examples –  Run QTP – Copy the below code and pate in notepad, same file as “ABC.vbs”.
Dim qtApp
Set qtApp = CreateObject(“QuickTest.Application”) ‘ Create the application object
qtApp.Launch ‘Start QuickTest
qtApp.Visible = True ‘ Make it visible
Now Run the “ABC.vbs”. It will open QTP.

Simple way to create script for automating QTP:
QTP also provides the option to generate the automation script (which controls the automation and functionalities of QTP). For this, first you need to open QTP manually and define all the appropriate QTP settings like – test settings, results settings, Options, Action settings, iteration settings etc.
Now go to Test Settings -> In General tab and Object Identification tab, there is “Generate Script” button. Clicking on the button will generate a vbs file with the defined settings.

In Next post we will discuss when to use these QTP automation scripts.

Pin It on Pinterest