Automation Object Model is a collection of
objects, methods and properties. This collection is used for performing quick
test operations. Any operation described in QTP interface can be performed
throughout automation object model.
Every option in QTP interface have objects,
methods and properties are exposed by Quick Test Automation Object Model along
with standard programming elements like control structures.
You can use the QuickTest
Professional Automation Object Model to write programs that automate your
QuickTest operations. The QuickTest Automation Object Model provides objects,
methods, and properties that enable you to control QuickTest from another application.
The new QuickTest Professional
Automation Object Model enables you to automate test management.
You can now control virtually every
QuickTest feature and capability using the objects, methods and properties
included in the QuickTest Professional Automation Object Model. Automation
scripts make it easy to perform any QuickTest operation multiple times in
multiple tests without having to open the QuickTest application, for example,
- You can write a script that modifies the test object
description properties in the Object Identification dialog box and
performs an update run on all tests in a specified file folder.
- After installing a new add-in, an automation script can
associate this add-in to all relevant tests.
- You can write an automation script to run a selected
batch of tests. For each test, you can retrieve the associated add-ins
list. Then, if the necessary add-ins are not already loaded, you can close
QuickTest, load the necessary add-ins, reopen QuickTest, and run the test.
- You can define your settings for a test in QuickTest,
then click “Generate Script” in the Generate tab of the Test Settings
dialog box to generate an automation script based on the current test
settings. You can then apply those same settings automatically to multiple
tests using the whole automation script or excerpts from the generated
file.
Example:
You can create and run an automation program from Microsoft Visual Basic that loads the required add-ins for a test, starts QuickTest in visible or minimized mode, opens the test, configures settings that correspond to those in the Options, Test Settings, and Record and Run Settings dialog boxes, runs the test, and saves the test.
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://www.gmail.com "
App.Test.Settings.Launchers("Web").CloseOnExit = True
App.Test.Settings.Launchers("Windows Applications").Active = True
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 = "<Default>"
App.Test.Settings.Resources.Libraries.RemoveAll
App.Test.Settings.Resources.Libraries.Add("D:\ENCRYPTED\LearningQTP\Functions\My Functions.qfl")
App.Test.Settings.Resources.Libraries.Add("D:\ENCRYPTED\LearningQTP\Variable\My_Constant_Variable.vbs")
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 "OnEveryStep"
App.Test.Settings.Recovery.Add "D:\Phoenix Automation\Recovery\Pop Up Window Explorer.qrs", "Pop Up Window Explorer", 1
App.Test.Settings.Recovery.Item(1).Enabled = True
App.Test.Settings.Recovery.Add "D:\Phoenix Automation\Recovery\fnSessionExpire.qrs", "fnSessionExpire", 2
App.Test.Settings.Recovery.Item(2).Enabled = True
App.Test.Settings.Recovery.Add "D:\Phoenix Automation\Recovery\Production Support Error - Recovery.qrs", "Production Support Error_Recovery", 3
App.Test.Settings.Recovery.Item(3).Enabled = True
App.Test.Settings.Recovery.Add "D:\Phoenix Automation\Recovery\Security Information Pop Up window.qrs", "Security Information Pop Up", 4
App.Test.Settings.Recovery.Item(4).Enabled = True
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' System Local Monitoring settings
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
App.Test.Settings.LocalSystemMonitor.Enable = false
You can create and run an automation program from Microsoft Visual Basic that loads the required add-ins for a test, starts QuickTest in visible or minimized mode, opens the test, configures settings that correspond to those in the Options, Test Settings, and Record and Run Settings dialog boxes, runs the test, and saves the test.
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://www.gmail.com "
App.Test.Settings.Launchers("Web").CloseOnExit = True
App.Test.Settings.Launchers("Windows Applications").Active = True
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 = "<Default>"
App.Test.Settings.Resources.Libraries.RemoveAll
App.Test.Settings.Resources.Libraries.Add("D:\ENCRYPTED\LearningQTP\Functions\My Functions.qfl")
App.Test.Settings.Resources.Libraries.Add("D:\ENCRYPTED\LearningQTP\Variable\My_Constant_Variable.vbs")
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 "OnEveryStep"
App.Test.Settings.Recovery.Add "D:\Phoenix Automation\Recovery\Pop Up Window Explorer.qrs", "Pop Up Window Explorer", 1
App.Test.Settings.Recovery.Item(1).Enabled = True
App.Test.Settings.Recovery.Add "D:\Phoenix Automation\Recovery\fnSessionExpire.qrs", "fnSessionExpire", 2
App.Test.Settings.Recovery.Item(2).Enabled = True
App.Test.Settings.Recovery.Add "D:\Phoenix Automation\Recovery\Production Support Error - Recovery.qrs", "Production Support Error_Recovery", 3
App.Test.Settings.Recovery.Item(3).Enabled = True
App.Test.Settings.Recovery.Add "D:\Phoenix Automation\Recovery\Security Information Pop Up window.qrs", "Security Information Pop Up", 4
App.Test.Settings.Recovery.Item(4).Enabled = True
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' System Local Monitoring settings
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
App.Test.Settings.LocalSystemMonitor.Enable = false
No comments:
Post a Comment