Search This Blog

Wednesday, December 29, 2010

Smart Identification Explained

When qtp fails to identify any object uniquely with help of learned description of the object it uses smart identification.Normally qtp uses its learned description for identifying an object & this learned description is sufficient to identify any object uniquely as it does not frequently but anyhow if any point of time qtp unable to identify object using its description or it finds more than one object, then it use smart identification techniques.

The Smart Identification Technique uses two properties :
  • Base Filter Properties. The most fundamental properties of a particular test object class; those whose values cannot be changed without changing the essence of the original object. For example, if a Web link’s tag was changed from <A> to any other value, you could no longer call it the same object.
  • Optional Filter Properties. Other properties that can help identify objects of a particular class. These properties are unlikely to change on a regular basis,but can be ignored if they are no longer applicable.
Smart Identification Process : 
QTP initiate smart identification Process when it is not able to identify any object during run session or more than one object with same description.Th following process is followed to identify object.
  1. As soon as smart identification initiate qtp forget all learned description based on mandatory & assistive properties & ordinal identifiers & create a new object candidate list containing the object which matches all of the defined base filter properties.
  2. QuickTest filters out any object in the object candidate list that does not match the first property listed in the Optional Filter Properties list. The remaining objects become the new object candidate list.
  3. QuickTest evaluates the new object candidate list:
    • If the new object candidate list still has more than one object, QuickTest uses the new (smaller) object candidate list to repeat step2 for the next optional filter property in the list.
    •  If the new object candidate list is empty, QuickTest ignores this optional filter property, returns to the previous object candidate list, and repeats step2 for the next optional filter property in the list.
    •  If the new object candidate list is empty, QuickTest ignores this optional filter property, returns to the previous object candidate list, and repeats step2 for the next optional filter property in the list.
  4. If the new object candidate list is empty, QuickTest ignores this optional filter property, returns to the previous object candidate list, and repeats step2 for the next optional filter property in the list.If the object candidate list contains exactly one object, then QuickTest concludes that it has identified the object and performs the statement containing the object QuickTest continues the process described in steps2 and3 until it either identifies one object, or runs out of optional filter properties to use.
    If, after completing the Smart Identification elimination process, QuickTest still cannot identify the object, then QuickTest uses the learned description plus the ordinal identifier to identify the object.If the combined learned description and ordinal identifier are not sufficient to identify the object, then QuickTest stops the run session and displays a Run Error message.
Reference : QTP help.




Tuesday, December 21, 2010

Object Identification Properties



In my last post i told you how qtp identify any object. Now we will discuss what all properties of an object qtp uses to uniquely identify it.

QTP uses following properties to uniquely identify any object 

1.    Mandatory Property 
2.    Assistive Property 
3.    Ordinal Identifier 
4.    Smart Identification

Before recording, these properties has to be defined for each object by a test engineer in QTP>Tools>Object Identification.

Let’s discuss these in detail.

1.    Mandatory Property :
As per qtp help “Quick Test has a list of mandatory properties that it always learns”. Whenever we record any object as Test Object QTP learns its specified mandatory properties which helps to uniquely identify any object. If QTP feel that these are more objects with same description it learns Assistive Properties.

2.    Assistive Properties :
As per qtp help are “Assistive Properties are properties that QuickTest learns only if the mandatory properties that QuickTest learns for a particular object in your application are not sufficient to create a unique description. If several assistive properties are defined for an object class, then Quick Test learns one assistive property at a time, and stops as soon as it creates a unique description for the object. If QuickTest does learn assistive properties, those properties are added to the test object description.”

3.    Ordinal Identifier :
As per qtp Help - The ordinal identifier assigns the object a numerical value that indicates its order relative to other objects with an otherwise identical description (objects that have the same values for all properties specified in the mandatory and assistive property lists). This ordered value enables QuickTest to create a unique description when the mandatory and assistive properties are not sufficient to do so.

The assigned ordinal property value is a relative value and is accurate only in relation to the other objects displayed when QuickTest learns an object. Therefore, changes in the layout or composition of your application page or screen can cause this value to change, even though the object itself has not changed in any way. For this reason, QuickTest learns a value for this backup ordinal identifier only when it cannot create a unique description using all available mandatory and assistive properties.

In addition, even if QuickTest learns an ordinal identifier, it will use the
identifier during the run session only if the learned description and the Smart Identification mechanism are not sufficient to identify the object in your application.

If QuickTest can use other identification properties to identify the object during a run session, the ordinal identifier is ignored.

QuickTest can use the following types of ordinal identifiers to identify an
object:
  • Index. Indicates the order in which the object appears in the application code relative to other objects with an otherwise identical description.
  • Location. Indicates the order in which the object appears within the parent window, frame, or dialog box relative to other objects with an otherwise identical description.
  • Creation Time. (Browser object only.) Indicates the order in which the browser was opened relative to other open browsers with an otherwise identical description.
When qtp identifies any object first, it learn all of its specified mandatory properties, if object is uniquely identified with these mandatory properties qtp stop learning its properties if qtp feel it is not able to identify object uniquely with help of all mandatory properties, it learns first assistive properties & verify if it is  ok to identify object uniquely, if still it feels that it need some more properties it learns second assistive property & this process continues till QTP identify the object uniquely.

Some time Mandatory & Assistive Properties are not sufficient for description of an object so it uses ordinal identifier to identify.

As last attempt to learn description the object if above all Properties fail to identify object uniquely it uses Smart Identification.

We will discuss Smart Identification later in detail.

Monday, December 20, 2010

How QTP identifies objects ???


How QTP identifies objects ???

QTP uses human like methods to identify any object. How we identify our friends/relatives????? Have you ever thought what process we follow to identify & remember any object in real world?....OK its rather simple as it seems when we see anything first time our mind remember some unique properties of this object….just like when I first saw Eiffel Tower I remember its design, Place,Colour,Height etc.So next time when I will see this my brain will use that information as repository of properties & check if any property of that building matches with same object…if both of the properties matches I will recognize this building as Eiffel Tower.

Some time you have experienced that you teach a kid A for Apple. How he remember Apple ? He identifies that apple is red colour fruit so when you show him some other red colour fruit look like apple he gets confused. Now later on when he retires & learns more properties of Apple on showing another fruit with same/different properties he identifies Apple successfully.

Now process of identifying objects might me clear in your mind same way QTP behaves like human when QTP records any object its captures its properties with its logical name & Physical description.i.e. Name, URL, html id etc & stores them in its object repository (Local/Shared), this object is save as Test Object. These properties are not dependent on location in AUT so even though in successive builds if your objects change location in AUT your test will not fail. When we run our test qtp checks for same objects which it stores in its repository in AUT & identify them using its properties stored in repository.

QTP uses following properties of Test Object to identify.

  1. Mandatory Property
  2. Assistive Property
  3. Ordinal Identifier
  4. Smart Identification
We will discuss these properties in detail in my next post….