AOM Scripting (Automation Object Model)
Object Model:
An object model is a structural representation of software objects (classes) that comprise 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
Set qtApp=Nothing
'------------------------------------------------------------------
2) Write an AOM script to execute series of tests
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 gcreddy
objQtp.Test.Run
objQtp.Test.Close
i = i+1
Loop
objQtp.Quit
Set objQtp = Nothing
'******************************************
No comments:
Post a Comment