Which is better Descriptive programming or object repository usage ?
1. Descriptive programming solves many object recognition and maintenance problems that are otherwise going to stay (if we use Object Repository). So, we can rely on Descriptive Programming, ignoring Object Repository.
What happens if we ignore Object Repository:
All the properties you use in Descriptive Programming will be treated as Mandatory properties. In turn we are losing the power of Assistive properties in the object recognition mechanism of QTP .
QTP identifies an object using test object description stored in Object Repository. This description is made up of two sets of properties:
1. Mandatory Properties
2. Assistive Properties
For any object you can dictate QTP what properties to consider as mandatory and what properties as Assistive properties in a facility called "Object Identification".
Quick Test learns all mandatory properties by default. If it can't create a unique description for the object using mandatory properties alone, it starts learning one assistive property at a time until it creates a unique description for the object in question.
So, what it means is that just because you told QTP to use several Assistive Properties, it does not mean that it learns them all. It learns only to the extent needed i.e. until a unique object description is created
Also, in Descriptive Programming, you can't make use of the modern technology available in QTP - Smart Identification. You can use this only if have Object Repository.
If an object is not learned into Object Repository, there will be no logical name, no assistive properties, nor there do any base and optional properties to use for smart identification.
2. Descriptive Programming is better than Object Repository in cases where objects in the application are dynamic in nature and need special handling to identify the object.
Objects whose properties change dynamically for each run or depending on input data can be handled equally well by Object Repository.
In both cases you can use global or local sheet parameters, environment parameters as well as regular expressions to parameterize object properties.
3. If the size of Object repository increases too much then it decreases the performance of QTP while recognizing an object. Descriptive Programming is better in such situations.
Size of the Object Repository has very little or nothing to do with performance of QTP. It is rather the nature and number of objects in a given page that impact the performance of QTP. For example if there is one web button on a web page, QTP needs only one property (class name) to uniquely recognize that object right away. If you have, say 100 web buttons in a web page, then QTP has to use additional properties to recognize the object (may be "Value" property). Like this, QTP keeps on using more and more properties until it recognizes the object uniquely and this is what causes performance degradation not the size of Object Repository. However using descriptive programming we can have just one utility function that can be called as and when we want to execute the specific event, by sending the associated set of properties for the corresponding objects. This is how we handle the Submit button click on all the pages in the application. We expect that each scenario requires the submit button to be clicked and parameterizing the properties and calling a single function helps us validate the scenario without increasing too much of the object repository size.
4. Descriptive Programming makes maintenance easy!
No. It is as bad/good as maintaining Object Repository. Just because if we use the traditional abject repository method, we can easily get the object set properties updated by using the tool provided within the QTP, however using descriptive programming, we need to manually alter the [properties and that is a very time consuming one.
5. QTP cannot take action on an object until unless its object description is in the Object Repository. But descriptive programming provides a way to perform action on objects which are not in Object repository
If an object is not defined in the object repository, you will have to create your own description of that object so that QTP can recognize and act on it. You will have to create the description very carefully otherwise you will get run error.
In Descriptive Programming, creating a workable description for some objects can prove to be very tedious and time consuming some times. Properties that work are not always consistent. Sometimes you have to dig through several combinations of properties to find one that works correctly.
You will be better off adding object to the Object Repository with just click of a button rather than creating a time consuming buggy description all by yourself.
6. Using Descriptive Programming, automation scripts can be created even if the application has not been developed.
If you build object descriptions (and scripts based on those descriptions) without ever spying on the objects, the chances are that, in more than 50% of the cases, the description might fail. But if you have great development discipline in place, we go for this approach. Several projects utilize the keyword driven aopproach to mae this all successful.
Scripts you create without having the application developed will hardly serve you any purpose. This is because, without having the application developed, you can't have active screens captured, can't insert checkpoints, can't output values. But Reporter.reportevent is something that serves the purpose with a beauty. You need to be sufficiently expert in the Vbscript usage and optimize the code using it by various combinations of conditional looping and things as such.
Advantages of Descriptive programming
Descriptive Programming Solves redundancy problem.
If you have same objects on many pages, you don't need to add them to Object Repository under each page. You can handle it with Descriptive Programming and avoid redundancy.
Descriptive Programming solves the problem of dealing with large number of objects of same type.
For example, you can't anticipate search results and put them in Object Repository in advance. You can create descriptions for such objects and make QTP act on them based on, for example, ordinal identifier. A yet another powerful utility in the object recognition mechanism.
Descriptive programming helps us handle special circumstances which otherwise can't be handled with Object Repository alone. However, in the final analyses, Descriptive Programming should NOT be treated as replacement for Object Repository for it is far from being a viable alternative to object Repository.
Descriptive Programming is a necessary exception rather than a norm. But, at the same time, we can't live without Descriptive Programming.
For gaining more insights in the automation using QTP log on to below url :
Automation Testing Using QTP