This is a frequently being discussed question within test automation teams while you are planning for an automation. I have also observed this question being asked in interviews as in “which way you would like to go for Object Repository or Descriptive programming?’ I believe there is no “verses” here, i.e. it is not something to choose between Object Repository or descriptive programming.
The way I see to it, is two different features of QTP meant for different purposes. It basically depends on the needs of the test, at some point you may need and simply use object repository and at some point there is no way without using Descriptive programming.
A simple example, lets say if you have to click on a link on a page. Its a very simple scenario, where simply adding the object into object repository will do the required. But in the same situation if you 100 links on the page and you need to verify each one of those by clicking. In this case its not good to have all the 100 objects in the OR whereas we should use descriptive programming here.
But in the case where you have to decide (irrespective of the need of test, I see many people create frameworks and decides not to use object repository and go with descriptive programming only) whether to go for either Object Repository or descriptive programming, I prefer to go with Object repository mostly (not very much convinced with “only” descriptive programming approach). Not only because it has been built for that purpose but it makes our life easy in multiple sense.
Here is another example, you have a page where you have a button with text as “Submit”. You have developed your script for the button click. Now in the next release the button text is changed and becomes “Submit Order”. if you have used Object Repository, you just need to change the text property of the button. All scripts using that repository will be updated automatically. But In case of Descriptive programming, you will have to manually modify every script requiring the update. I understand that we can definitely sort this out in scripting as well. I have some more pointers 🙂 Descriptive programming statements need to be implemented manually. Finding a set of properties to uniquely identify the object consistently can be time consuming. To help with selecting the properties, you can use the Object Spy or temporarily add the object to the repository.
QTP/UFT identifies an object using a set of property/value pairs that uniquely identify the object. When determining whether to use the object repository or descriptive programming, you should consider how the property/value pairs are selected and used.When objects are learned into the object repository, QTP/UFT automatically determines which properties and values are needed to uniquely identify the object. QTP/UFT starts with a predefined set of mandatory properties that must be learned. If those properties do not uniquely identify the object, QTP/UFT includes predefined Assistive properties, one at a time, until there is a unique identification. If the mandatory and assistive properties do not uniquely identify the object, QTP/UFT includes an ordinal identifier. In addition to these properties, if Smart Identification is enabled for the object class, QTP/UFT will learn additional properties that can be used during replay if the defined object definition does not match an object in the application. During replay, if QTP/UFT cannot find an object using the defined properties or smart identification, an error (“Cannot identify object”) will be generated.
QuickTest Professional (QTP) / Unified Functional Testing (UFT) can perform faster when using information from the object repository to identify the object. When QTP/UFT first encounters an object during replay, it uses the object description (from the Object Repository) to create a temporary version of the test object. For the remainder of the test run, QTP refers to that temporary version of the test object rather than to the test object in the object repository. This internal “mapping” helps QTP locate the objects quickly. Statements using descriptive programming can be slower. This is because QTP/UFT must check every object and compare it with the specified properties to find a match.
When descriptive programming is used, all property pairs that are listed are considered mandatory. You must manually create the property list to identify the object at runtime. During replay, if QTP/UFT cannot find an object using the defined properties, an error (“General Run Error” or “Cannot identify object”) will be generated. To help with selecting the properties, you can use the Object Spy or temporarily add the object to the repository.
additionaly Descriptive programming is useful when you need to perform an operation on an object whose properties match a description determined dynamically during replay.
Example:OrderNo = 4 ‘ assume the order number is generated during test execution
Window(“Flight Reservation”).WinEdit(“attached text:= Order No:”, “text:=”& OrderNo).Highlight
If you will be using the object description in multiple statements, you can create a Description object to hold the description.
Let us know your views on this, which one you prefer to go with and in what scenarios.
Thanks. It is really a good explanation to answer the question for object repository
while creating Keyword framework, I am getting lot of confusion. below is my structure.
1) Function lib
2) Test Data
3) Test Case(manual)
4) Main script
5) test Group
could you help me to create good Frmework.
it will help, if you can elaborate your confusion. I dint get your fifth component ‘test Group’
Thanks for your help:
Test Group: This is a sheet which specifies the business flow of the test case. if contains a series of business keywords Mapped against each TEst case.
i got the ans for my confusion.
Ah, i see. Well tha’ts not too tricky at all!”
1) what is difference between event and mouse?
2) What is the difference between FireEvent and ReplayType 2?
could you help me where and which scenario, i could use Dictionary object in my project.
I am working on windows based java application.It has a java tree whose branches value changes with application environment being used.When recording with qtp it stores hard code index value of branch chosen.So doesn’t work in different environment as the position of same desired branch changes.Can you please guide me on this how to automate so that it works in all environment
you can simple use Select method to select a node in your tree. e.g if you tree structure is like “Parent Node > Sub Node > Item”
your statement should be like –
JavaWindow("x").JavaDialog("x").JavaTree("x").Select "Parent Node;Sub Node; Item"
if this does not work then you should go for descriptive, check each node and select
1. get the count of items/nodes in the tree
2. loop through the items get itemaname, use getItem
3. if name matches the required select the item, use Select method.
let me know if this helps.
I am a beginner .I am learning uft please any one suggest me .How I can learn qtp .which type of knowledge require to make career in software automation
briefly, you should some/basic programming knowledge to work with test automation tools. for QTP/UFT you should have VBScripting knowledge. Yes you can learn easily, get your hands on VBScript. you can start with UFT here – https://automated-360.com/topics/unified-functional-testing/
[…] Model is like Object Repository in UFT. It contains test object’s hierarchy, description and properties. Applications model enables […]
[…] used Virtual Object in UFT and that too using in recording mode. You are wondering, if we can use descriptive programming for virtual objects as well! The answer is — definitely a “YES”. UFT does have […]
[…] objects in hierarchy for better readability and maintainability when objects get added into the Object Repository (OR). You can dig into the hierarchy and reach to the object you want to, because of the […]
[…] two ways of adding insight objects either while recording or add insight objects directly into Object Repository (OR). While recording, you need to choose the recording mode as “Insight Recording”. In this […]