Saturday, 19 November 2011


AOM Scripting (Automation Object Model)

Object Model:

An object model is a structural representation of software objects (classes) thatcomprise the implementation of a system or application. An object model defines a set of classes and interfaces, together with their properties, methods and events, and their relationships. 


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.


Example:
1) Write an AOM Script to launch QTP Tool, Execute Tests and to close the QTP Tool
option explicit
Dim qtApp
Set qtApp=createobject ("Quicktest.Application")
qtApp.Launch
qtApp.visible=True

qtApp.open "C:\Documents and Settings\admin\My Documents\login"
qtApp.Test.Run
qtApp.Test.Close

qtApp.open "C:\Documents and Settings\admin\My Documents\open order"
qtApp.Test.Run
qtApp.Test.Close

qtApp.quit
Set qtApp=Nothing

Note: AOM Script can be used in Automation framework as an Initialization script.
'------------------------------------------------------------------
 2) Write an AOM script to execute series of tests

Dim objFso,objQtp,myFile,i,traininghub

Set objQtp = CreateObject("Quicktest.Application")
objQtp.Visible = True
objQtp.Launch

Set objFso =CreateObject("Scripting.FileSystemObject")
Set myFile = objFso.OpenTextFile("C:\Users\Chinni\Desktop\Test\gcreddy.txt")
i =1
Do Until myFile.AtEndOfStream =True
testurl =  myFile.ReadLine

objQtp.Open traininghub
objQtp.Test.Run
objQtp.Test.Close
i = i+1
Loop

objQtp.Quit
Set objQtp = Nothing
'******************************************

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