qtp: object repository, descriptive programming and beyond
DESCRIPTION
QTP: Object Repository, Descriptive Programming and Beyond. Prepared by: Igor Gershovich. Object Repository vs. Descriptive Programming –what to use?. There really is no “best way” - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: QTP: Object Repository, Descriptive Programming and Beyond](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813bae550346895da4e398/html5/thumbnails/1.jpg)
QTP: Object Repository, Descriptive Programming and Beyond
Prepared by: Igor Gershovich
![Page 2: QTP: Object Repository, Descriptive Programming and Beyond](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813bae550346895da4e398/html5/thumbnails/2.jpg)
Object Repository vs. Descriptive Programming –what to use? There really is no “best way” Use the method that gives your company the
best ROI, whether that be Object Repository (OR), Descriptive Programming (DP) or a mixture of both
![Page 3: QTP: Object Repository, Descriptive Programming and Beyond](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813bae550346895da4e398/html5/thumbnails/3.jpg)
OR Pros and Cons
PROS: GUI Front end to examine all the objects in
the repository Highlight in Application feature is great tool to
walk the object tree No need to modify the script when object
properties changes Easy to identify objects in AUT by Object
Logical names Can be created independently from scripts
![Page 4: QTP: Object Repository, Descriptive Programming and Beyond](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813bae550346895da4e398/html5/thumbnails/4.jpg)
OR Pros and Cons
CONS: Additional layer to maintain Unnecessary objects can be created Multiple users cannot concurrently save/write
to the shared OR It won’t eliminate the need for Descriptive
Programming in most of cases
![Page 5: QTP: Object Repository, Descriptive Programming and Beyond](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813bae550346895da4e398/html5/thumbnails/5.jpg)
DP Pros and Cons
PROS: It’s a white box Compatible with different QTP versions Code portability is high Easy to mass update
![Page 6: QTP: Object Repository, Descriptive Programming and Beyond](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813bae550346895da4e398/html5/thumbnails/6.jpg)
DP Pros and Cons
CONS: Lower Code Readability and requires more
comments, like “what object is accessed” Potentially slower to create To highlight an object in the application
requires utilizing the “Highlight” method
![Page 7: QTP: Object Repository, Descriptive Programming and Beyond](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813bae550346895da4e398/html5/thumbnails/7.jpg)
What is Object Repository?
Object Repository is a place where QTP stores learned objects
QTP uses default Object Identification properties: mandatory and assistive to learn objects into OR
![Page 8: QTP: Object Repository, Descriptive Programming and Beyond](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813bae550346895da4e398/html5/thumbnails/8.jpg)
Object Repository
Logical Name
Properties
![Page 9: QTP: Object Repository, Descriptive Programming and Beyond](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813bae550346895da4e398/html5/thumbnails/9.jpg)
OR: Object identification default properties
![Page 10: QTP: Object Repository, Descriptive Programming and Beyond](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813bae550346895da4e398/html5/thumbnails/10.jpg)
Script playback using OR
QTP finds the Object in Object Repository using object Logical Name and Object Hierarchy
QTP retrieves Test Object properties from OR
QTP searches actual application for the Object with the same properties as the OR Test Object and performs user action
![Page 11: QTP: Object Repository, Descriptive Programming and Beyond](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813bae550346895da4e398/html5/thumbnails/11.jpg)
Script playback using Descriptive programming QTP searches the Application Under Test
(AUT) for the Object using Descriptive properties and performs user action
![Page 12: QTP: Object Repository, Descriptive Programming and Beyond](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813bae550346895da4e398/html5/thumbnails/12.jpg)
Descriptive programming – when and why?Consider using DP in following cases: Dynamic object properties
Example: Link Logout <User Name> Same objects on every page
Example: Buttons – Next, Back, Cancel, OK Lots of similar objects on one page
Example: table with many First & Last name text boxes
![Page 13: QTP: Object Repository, Descriptive Programming and Beyond](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813bae550346895da4e398/html5/thumbnails/13.jpg)
Different ways to work with objects
![Page 14: QTP: Object Repository, Descriptive Programming and Beyond](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813bae550346895da4e398/html5/thumbnails/14.jpg)
Different ways to work with objects Example for Passenger 1 First Name
![Page 15: QTP: Object Repository, Descriptive Programming and Beyond](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813bae550346895da4e398/html5/thumbnails/15.jpg)
ChildObjects method – using Collection Object
![Page 16: QTP: Object Repository, Descriptive Programming and Beyond](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813bae550346895da4e398/html5/thumbnails/16.jpg)
ChildObjects method – using Collection ObjectLast Name fields
are populated
![Page 17: QTP: Object Repository, Descriptive Programming and Beyond](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813bae550346895da4e398/html5/thumbnails/17.jpg)
TO, RO and .Object
.GetTOproperty/SetToProperty refers to the properties stored in OR
.GetROProperty property refers to the AUT Object property (Run-time)
.Object.<property/method> refers to the AUT Object NATIVE properties/methods
![Page 18: QTP: Object Repository, Descriptive Programming and Beyond](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813bae550346895da4e398/html5/thumbnails/18.jpg)
Better names for Object Spy radio-buttons
Run-Time NATIVE Object Run-Time QTP (Test) Object
![Page 19: QTP: Object Repository, Descriptive Programming and Beyond](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813bae550346895da4e398/html5/thumbnails/19.jpg)
Object Run-Time Properties from AUT (GetRoProperty)
![Page 20: QTP: Object Repository, Descriptive Programming and Beyond](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813bae550346895da4e398/html5/thumbnails/20.jpg)
Run-Time “Native” Object Properties/Methods from AUT (.Object)
![Page 21: QTP: Object Repository, Descriptive Programming and Beyond](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813bae550346895da4e398/html5/thumbnails/21.jpg)
Test Object Properties from ORSet/GetToProperty
![Page 22: QTP: Object Repository, Descriptive Programming and Beyond](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813bae550346895da4e398/html5/thumbnails/22.jpg)
Regular Expressions in ORExample: Server independent Page object1. Click on Property value to access RegEx 2. Click RegEx Icon
![Page 23: QTP: Object Repository, Descriptive Programming and Beyond](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813bae550346895da4e398/html5/thumbnails/23.jpg)
Regular Expressions in OR
![Page 24: QTP: Object Repository, Descriptive Programming and Beyond](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813bae550346895da4e398/html5/thumbnails/24.jpg)
Regular Expressions in OR
RegEx icon
![Page 25: QTP: Object Repository, Descriptive Programming and Beyond](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813bae550346895da4e398/html5/thumbnails/25.jpg)
Object Smart Identification
Smart Identification is not Artificial Intelligence
SI uses loose/unreliable object recognition It’s recommended to disable SI for each and
every page/window/control using the Tools->Object Identification dialog (Recording)
Another way to disable SI: File -> Settings -> Run -> Check the "Disable Smart Identification during run session" check box (Run-Time)
![Page 26: QTP: Object Repository, Descriptive Programming and Beyond](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813bae550346895da4e398/html5/thumbnails/26.jpg)
Smart Identification (SI) Recording Options
SI Checkbox
![Page 27: QTP: Object Repository, Descriptive Programming and Beyond](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813bae550346895da4e398/html5/thumbnails/27.jpg)
Smart Identification (SI) Run Option
SI Checkbox
![Page 28: QTP: Object Repository, Descriptive Programming and Beyond](https://reader035.vdocuments.mx/reader035/viewer/2022062321/56813bae550346895da4e398/html5/thumbnails/28.jpg)
Resources
QA Forums – www.sqaforums.com HP/Mercury QTP User guide Knowledge inbox (by Tarun Lalwani) -
http://www.knowledgeinbox.com/ Microsoft TechNet -
http://www.microsoft.com/technet/scriptcenter/