Tuesday, 1 March 2011




Automation Object Model (AOM) in QTP


We can use QTP Automation object Model to write scripts that automate our QTP operations.

QTP Automation object model provides objects, methods and properties that enable us to control QTP from another application.

We can use Scripting languages or programming languages such as VBscript, Java script or VC++, .Net for automating QTP operations.

Navigation to Create the AOM file:

1. Open the text file à Give the name extension with .vbs à Save the file on desktop.
2. D-Click on that .vbs files for run the script.

Method I: To Pre-Configure QTP Test Settings we can use automation object model.

Ex1. Write an AOM Script to launch QTP Tool without datatable, debugviewer, activescreen and Execute Tests and to close the QTP Tool.

Before Start this program QTP tool settings snap shot like this:
Observation: here open activescreen, datatable, debug viewer open






Navigation:
Step 1. Prepare the Login, Open Order, Logout Tests

QTP Test Name: Login
SystemUtil.Run "C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe"
Dialog("Login").Activate
Dialog("Login").WinEdit("Agent Name:").Set "hp44"
Dialog("Login").WinEdit("Password:").SetSecure "4f4f29118ef296ddcda418a6b14ed8afdd9ed2fd"
Dialog("Login").WinButton("OK").Click

QTP Test Name: OpenRec
Window("Flight Reservation").Activate
Window("Flight Reservation").WinMenu("Menu").Select "File;Open Order..."
Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Order No.").Set "ON"
Window("Flight Reservation").Dialog("Open Order").WinEdit("Edit").Set "5"
Window("Flight Reservation").Dialog("Open Order").WinButton("OK").Click
Window("Flight Reservation").Activate

QTP Test Name: Logout
Window("Flight Reservation").Activate
Window("Flight Reservation").WinMenu("Menu").Select "File;Exit"

Step 2. Save the above Tests with Repository in C:\Drive

Step 3. Create AOM.vbs file with the following script with help of notepad.

Set qtApp = createobject("QuickTest.Application")   ‘Create object for QTP application

qtApp.Visible = true   ' we can able to see the qtp
qtApp.Launch         'open the qtp without datatable, debugviewer, activescreen

qtApp.ShowPaneScreen "datatable",False  ‘qtp does not show the Datatable
qtApp.ShowPaneScreen "debugviewer",False  ‘qtp does not show the debuviewer
qtApp.ShowPaneScreen "activescreen",False    ‘ qtp does not show the active screen

qtApp.Open "c:\Login"          'open the Login test automatically
qtApp.Test.Run                    ' run the Login test

qtApp.Open "C:\OpenRec"    'open the OpenRec test automatically
qtApp.Test.Run                    'run the OpenRec test    

qtApp.Open "C:\Logout"       'open the Logout test automatically
qtApp.Quit                          'run the Logout test


Step  4. For Run the test à simply D-Click on the AOM.vbs file.

Output:
This AOM Script opens automatically QTP without open the data table, debug viewer, active screen panes, open tests and execute one by one, at the last close the QTP application. 






0 comments:

Post a Comment

TrainingHUB. Powered by Blogger.

Total Pageviews

THE BEST QTP TRAINING INSTITUTE IN HYDERABAD

QTP Training in hyderabad

Sql Tutorial

Popular Posts

Our Facebook Page

TrainingHUB

Followers