Object identification by QTP is a bit complex mechanism.It runs an algorithm to detect an object under a dynamic page similar way that a person would look at a photograph and try to remember details.
1. QTP looks at the object and try detect the class of the test object.For each test object class,QTP has a list of mandatory properties so when we record an object QTP learns these dafault property values. It tries to determine the object uniquely.
Think about a scenario where QTP is trying to enter value to a ID field and a PASSWORD filed in a login page.even though there are two textfileds available in the web page, their names are different, so QTP can identify these two fileds uniquely by mandate property-name.
2. If mandatory properties fails to determine the object uniquely ,QTP tries to identify an assistive property. It adds these properties one by one.It continues the same operation untilit has complited an unique description.
Imagine there are two arrows present in a page called next.I mean the name is same for both the objects. Position of the arrows are..
1. Top of the page
2. Bottom of the page
Their names are same so, by, mandate property “name” , QTP can not identify this object . Now it will go for assistive properties.
Index value can be an assistive property for the same.
It is like a classroom having 30+ students . There is no roll no assigned to them. Now if we try to call one of them. Name is sufficient to identify uniquely. Problem will occure if there are 2/3 students having same name.
To solve this we might assign some value to each of these person to identify uniquely. Remember our own school days….Lambu Suman(Tall Suman), Archi-man(archimedes+Suman ,,Suman good at math),Changra Suman( Suman who is bit childish) are few names to identify each of the suman uniquely. This is kind of Assistive properties..
The code for this will look like:
3. If no assistive properties available or if assistive properties fails to determine the object properly then QTP adds a special ordinal identifier such as location ,source code etc.
EXP-Mandate-Webbutton-class object-button name= next
Coordinate is the dafult ordinal identifier.