A Real life Example in QTP Identification: Mandatory Properties, Assistive Properties, Ordinal Identifiers.
Consider yourself as the Automation developer, myself as QTP and a parking lot as the application, cars parked in the parking area as the Test Objects.
Now you ask me (QTP) to bring a car from the parking lot and you point me to the car ( This is adding the Test Object to Object repository or recording on the same). By my previous knowledge and what I am programmed to learn, I look at the car and remember its # plate so that I can identify the same in future. The color of the car is red but I don’t remember this as # plate (My mandatory property settings) is good enough for me to recognize. This is about learning mandatory properties.
Now if I add color property to Mandatory list I will have 2 properties for identifying the car. If the car is painted to white color I would not be able to locate the car as I am still looking for a red color car with the same # plate as the white one in front of me. So this is why we don’t add all properties to Mandatory list
Now let assume this parking lot has some new cars which has no # plates. So my mandatory properties doesn’t give me anything to re-identify the car later. I start looking at my assistive properties which is the color in this case. The parking lot has only 1 red car so I remember the color as well to re-identify the car. This is about learning assistive properties. If one assistive property doesn’t help I would look at others one by one.
So far so good. Now if we have another red car parked in the parking, so my identification of blank #plate and red color will still not resolve which car to pick. So I need to make a choice based on 1st or the 2nd one (index), left one or the right one (location), the car that came first in the parking lot or the one came later (creationtime in case of browser). This is where we need ordinal identifier.
Now coming to smart identification. Consider you told me to pick a red color car with some plate #X and car was repainted to white. Now I don’t find anything in the lot and I start getting smart. I would say lets just drop off all what you said and see if I can find the car. I first see how many cars in the lot, If there is only 1 then my issue is solved. But lets say there are 3 cars, Now my SI algo says to look for the #plate and i find that white car matches the # plate so I pick it up and the car for you. This is what is Smart Identification.
If my Smart identification had color as the first property to be checked then I would have looked only at white car present in the parking lot, if I found one I would give the same to you. Even though our car may not be present in the parking lot I still give you a car which may not be the one you were looking for. This is why it always advised to keep Smart Identification disabled.
Coming back to the QTP world I would like to highlight another point now. Mandatory, Assistive properties only come into picture when we add an object to the OR or record some action on the same. While identifying the object again QTP will not differentiate which property was a Mandatory one or Assistive one. It would just try to match all the properties it had been given to identify the object.
There is a small difference when it comes to ordinal identifiers. QTP only uses ordinal identifiers when there are multiple matches of an object. So Browser(”creationtime:=50″) is same as Browser(”micclass:=Browser”) when you only have one browser open as QTP will not use the Creationtime property at all. But when 2 browsers exist QTP will throw an error as there is none with creationtime:=50
I hope this cleared all doubts about these different properties are used in QTP to add and identify the object later.
Browse more on Object properties
Using Qtp Efficiently
QTP Object Properties
Qtp Object Repository
For gaining more insights in the automation using QTP log on to below url :
Automation Testing Using QTP
The concept explained very clearly... Thanks Viplav
ردحذفإرسال تعليق