5/29/14

UFT- Automation Object Model

Automation Object Model:

QTP itself can be automated using the COM interface that is provided by Hp-QTP. Automation object model is a set of objects, methods, and properties that helps testers to control the configuration settings and execute the scripts using the QTP interface. The Key Configurations/actions that can be controlled are listed below but not limited to
  1. Loads all the required add-ins for a test
  2. Makes QTP visible while execution
  3. Opens the Test using the specified location
  4. Associates Function Libraries
  5. Specifies the Common Object Sync Time out
  6. Start and End Iteration
  7. Enable/Disable Smart Identification
  8. On Error Settings
  9. Data Table Path
  10. Recovery Scenario Settings
  11. Log Tracking Settings
QTP 11.5x provides an exclusive documentation on Automation Object model that can be referred by navigating to "Start" >> "All Programs" >> "HP Software" >> "HP Unified Functional Testing" >> "Documentation" >> "Unified Functional Testing Automation Reference"

Generate AOM Script:

Tester can generate AOM Script from QTP itself using "Generate Script" Option. Navigate to "Run" >> "Settings" >> "Properties" Tab >> "Generate Script" as shown below:
Automation Object Model

Example

' A Sample Script to Demostrate AOM
Dim App 'As Application
Set App = CreateObject("QuickTest.Application")
App.Launch
App.Visible = True
App.Test.Settings.Launchers("Web").Active = False
App.Test.Settings.Launchers("Web").Browser = "IE"
App.Test.Settings.Launchers("Web").Address = "http://easycalculation.com/"
App.Test.Settings.Launchers("Web").CloseOnExit = True
App.Test.Settings.Launchers("Windows Applications").Active = False
App.Test.Settings.Launchers("Windows Applications").Applications.RemoveAll
App.Test.Settings.Launchers("Windows Applications").RecordOnQTDescendants = True
App.Test.Settings.Launchers("Windows Applications").RecordOnExplorerDescendants = False
App.Test.Settings.Launchers("Windows Applications").RecordOnSpecifiedApplications = True
App.Test.Settings.Run.IterationMode = "rngAll"
App.Test.Settings.Run.StartIteration = 1
App.Test.Settings.Run.EndIteration = 1
App.Test.Settings.Run.ObjectSyncTimeOut = 20000
App.Test.Settings.Run.DisableSmartIdentification = False
App.Test.Settings.Run.OnError = "Dialog"

App.Test.Settings.Resources.DataTablePath = ""
App.Test.Settings.Resources.Libraries.RemoveAll

App.Test.Settings.Web.BrowserNavigationTimeout = 60000
App.Test.Settings.Web.ActiveScreenAccess.UserName = ""
App.Test.Settings.Web.ActiveScreenAccess.Password = ""

App.Test.Settings.Recovery.Enabled = True
App.Test.Settings.Recovery.SetActivationMode "OnError"
App.Test.Settings.Recovery.Add "D:\GUITest2\recover_app_crash.qrs", "Recover_Application_Crash", 1
App.Test.Settings.Recovery.Item(1).Enabled = True 
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' System Local Monitoring settings
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
App.Test.Settings.LocalSystemMonitor.Enable = false
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Log Tracking settings''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
With App.Test.Settings.LogTracking 
 .IncludeInResults = False 
 .Port = 18081 
 .IP = "127.0.0.1" 
 .MinTriggerLevel = "ERROR" 
 .EnableAutoConfig = False 
 .RecoverConfigAfterRun = False 
 .ConfigFile = "" 
 .MinConfigLevel = "WARN" End With

1 comment:

  1. Thanks for your informative article on UFT automation testing tool. Your post helped me to understand the features and functionality of QTP automation testing tool. QTP Course in Chennai | QTP training

    ReplyDelete