QTP AOM (Automation Object Model) can be used to automate
QTP Operations. Using the
objects, methods, and properties exposed by the Quick Test automation object
model,we can execute script, configure options settings,
Creating the QTP Object
Below lines of
codes creates an instance of QTP,launches QTP and makes it visible.
Dim qtApp
If we want to execute on a remote computer, we use
Set qtApp =
CreateObject("QuickTest.Application",”server”)
If we want to connect to QC from QTP AOM
qtApp.TDConnection.connect “QC URL”,”Domain”,”Project”,”User”,”Pwd”
Working With QTP Tests using AOM
Open a new Test
Dim qtApp
Set qtApp =
CreateObject("QuickTest.Application")
qtApp.Launch 'Start QTP
qtApp.Visible = True
qtApp.New
Opening an Existing Test
qtApp.Open “Test Path”,”True” ‘ Opens in read only
mode.
Running a test through AOM
qtApp.Test.Run
Saving a test in QTP
If qtApp.Test.IsNew Then
qtApp.Test.SaveAs
"C:\QTP\testqtp"
Else
qtApp.Test.Save
End If
Generating script for QTP Settings and QTP Options for AOM
Defining Settings in QTP
To know, how
settings are defined and QTP object is launched, and settings are defined
using AOM, Go to File>Settings>Properties and click on Generate Script.
This will generate a script with all the default setting parameters
The Content of the
script will be as follows:
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.rediff.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.Web.BrowserNavigationTimeout =
60000
App.Test.Settings.Web.ActiveScreenAccess.UserName
= ""
App.Test.Settings.Web.ActiveScreenAccess.Password
= ""
Defining Options in QTP
To know the current options settings in QTP, we can generate a script similar to Settings as defined above through Tools>Options>General and clicking on generate scripts.
Set App = CreateObject("QuickTest.Application")
App.Launch
App.Visible = True
App.Options.DisableVORecognition = False
App.Options.AutoGenerateWith = False
App.Options.WithGenerationLevel = 2
App.Options.TimeToActivateWinAfterPoint = 500
App.Options.SaveLoadAndMonitorData = True
App.Options.Run.RunMode = "Fast"
App.Options.Run.ViewResults = True
App.Options.Run.StepExecutionDelay = 0
App.Options.Run.MovieCaptureForTestResults = "Never"
App.Options.Web.AddToPageLoadTime = 10
App.Options.Web.RecordCoordinates = False
App.Options.Web.RecordMouseDownAndUpAsClick = False
App.Options.Web.RecordAllNavigations = False
App.Options.Web.RecordByWinMouseEvents = ""
App.Options.Web.BrowserCleanup = False
App.Options.Web.RunOnlyClick = False
App.Options.Web.RunMouseByEvents = True
App.Options.Web.RunUsingSourceIndex = True
App.Options.Web.EnableBrowserResize = True
App.Options.Web.PageCreationMode = "URL"
App.Options.Web.CreatePageUsingUserData = "Get Post"
App.Options.Web.CreatePageUsingNonUserData = ""
App.Options.Web.CreatePageUsingAdditionalInfo = True
App.Options.Web.FrameCreationMode = "URL"
App.Options.Web.CreateFrameUsingUserData = "Get Post"
App.Options.Web.CreateFrameUsingNonUserData = ""
App.Options.Web.CreateFrameUsingAdditionalInfo = True
App.Options.WindowsApps.AttachedTextRadius = 35
App.Options.WindowsApps.AttachedTextArea = "TopLeft"
App.Options.WindowsApps.ExpandMenuToRetrieveProperties = True
App.Options.WindowsApps.NonUniqueListItemRecordMode = "ByName"
App.Options.WindowsApps.RecordOwnerDrawnButtonAs = "PushButtons"
App.Options.WindowsApps.ForceEnumChildWindows = 0
App.Options.WindowsApps.ClickEditBeforeSetText = 0
App.Options.WindowsApps.VerifyMenuInitEvent = 0
App.Options.TextRecognitionOrder = "APIThenOCR"
App.Folders.RemoveAll
QTP is most popular automation functional graphic user interface (GUI) testing tool from HP. This tool is used for functional regression testing of a software product or environment. Candidates well versed in QTP technology have huge career opportunity in IT sector.
ReplyDeleteI don't think the job market for QTP script developers is as 'huge' as you think. with emerging technologies in IT automation tools that support multiple languages are eroding HP's market share. The steep price of QTP/UFT, limits of VBScript (an unsupported scripting language) and the declining value of the "Record/Play" model will continue to create challenges for HP. The IT industry is moving away from Test Automation and moving towards Software Developers in Test (SDT) and if you want to stay on the train of progress a Test Automator will have make the transition into SDT.
Delete++++1
DeleteThanks for your informative article on UFT automation testing tool. Your post helped me to understand the features and functionality of QTP automation testing tool. Best QTP training institute in Chennai
ReplyDeleteThis information is impressive; I am inspired with your post writing style & how continuously you describe this topic. After reading your post, thanks for taking the time to discuss this, I feel happy about it and I love learning more about this topic..
ReplyDeleteInformatica Training in chennai | QTP Training in Chennai
Really awesome blog. Your blog is really useful for me. Thanks for sharing this informative blog. Keep update your blog.
ReplyDeleteOracle Training In Chennai
Truely a very good article on how to handle the future technology. After reading your post,thanks for taking the time to discuss this, I feel happy about and I love learning more about this topic.
ReplyDeleteQTP training in chennai...
http://www.traininginsholinganallur.in/qtp-training-in-chennai.html
Really your content is so informative. so please share some more content ..
ReplyDeleteQTP training institute in Delhi
Thanks for sharing information with clear explanation. This is really awesome to understand.
ReplyDeleteThanks,
QTP Training in Chennai| Selenium Training in Chennai