Wednesday, 23 January 2013

EVERYTHING ABOUT QA



Object Identification in QTP
QTP identifies each object uniquely based on the properties that are configured in Object identification window. When QTP is installed on a machine, it comes along with some basic properties configured basing on which QTP can identify some of the objects while recording and playback.
However, when it comes to AUT recording, there might be lot of cases where QTP can’t identify an object uniquely based on the properties that are mentioned in Object identification. In such cases while the script is played back, QTP stops execution and throws an error. To overcome this, object identification properties has to be configured.
There are so many properties for every object defined by default in QTP for identifying. Some of them are:
Class, name, disabled, default value, max length, value, abs_x, abs_y, height, width, innerhtml, innertext, outerhtml, outertext, htmlid, htmltag, href and so on. User can use the same properties or add some new properties through Object identification screen.
There are three types of identification methods in QTP:
1. Normal Identification
2. Smart Identification
3. Ordinal Identifier
1. Normal Identification
This is in turn divided into two sections:

a. Mandatory Properties
b. Assistive Properties
a. Mandatory Properties:

Open Object identification window from TOOLS>Objection identification.And then select the environment of the application whether it is windows, ActiveX or web. For example let us assume that the environment is WEB. As soon as the environment is selected, QTP displays list of objects in the left side of the menu. Select an object.


Now it is observed that right side of the window displays Mandatory properties section and Assistive properties section. Observe the properties that are mentioned in Mandatory properties section. Those are the properties that are set by default while QTP is installed. QTP identifies each and every object while recording/execution based on the properties that are mentioned here.
To edit the existing in the list, click on Add/remove button.



Select the property that you want to add by clicking on the checkbox. And for removing just uncheck the checkbox. If you want to add a new property for the selected object which does not exist in the property list, then just click on ‘New’ button available there and enter the name in the edit box.


Select the basic properties basing on which QTP can easily differentiate the difference between two objects in mandatory section (for example like class, name).
b. Assistive Properties
If QTP is not able to identify an object uniquely based on the properties mentioned in Mandatory, then it comes to Assistive and verifies whether any properties are configured in it or not. If there are any properties configured in Assistive properties section, then QTP stores those properties also while recording an object and uses the same while execution. Configuring of properties in Assistive section is similar to configuration of Mandatory section.


Note 1: If QTP is able to identify an object uniquely based on the properties mentioned in Mandatory, then it doesn’t come to assistive or remaining properties.
Note 2: If QTP is not able to identify an object uniquely based on the properties mentioned in Mandatory and if there are no properties configured in Assistive section, then QTP just ignores assistive section and moves to Smart Identification/Ordinal identifier to verify whether they are configured or not!!!
Note 3: QTP will not allow to choose the same property in Mandatory and Assistive section.

2. Smart Identification:

Smart Identification is again in turn divided into two types

a. Base filter properties
b. Optional filter properties
When QTP is not able to identify an object uniquely based on the properties mentioned in Normal identification (Mandatory/Assistive) then QTP comes to Smart Identification.
Smart Identification is not enabled by default. To enable Smart identification click on checkbox available in the right side of the window under Normal identification.

After the checkbox is checked, then the configure button gets enabled. Clicking on configure icon will take the user to Base filter and Optional filter section.

a. Base filter properties:
If QTP is unable to identify an object uniquely based on the properties mentioned in Mandatory and Assistive (if configured), then it comes to smart identification Base filter properties section. Configuring the base filter properties is just similar to configuring the Mandatory/assistive properties section. Add the properties using Add/Remove button.
b. Optional filter properties:
If QTP is unable to identify an object uniquely based on the properties mentioned in Mandatory, Assistive and Base filter properties, then it comes to Optional filter properties. Configuring is same just like others. Add the properties using Add/Remove button.
Note 1: QTP will allow adding the same property that is mentioned in Mandatory/Assistive section. But it is just wasting the memory again by duplicating the property addition.
Note 2: QTP will not allow adding the same property in both Base filter and optional filter sections.
Note 3: QTP will come to Smart identification only if it is unable to identify an Object with the properties mentioned in Mandatory and Assistive
Note 4: QTP will come to Smart identification only when Smart identification check box is checked.
Note 5: QTP will not display the list of properties that are mentioned in smart identification in Object repository unlike Normal identification. It just displays Smart identification as ‘True’ if it is configured. See the following window:
The properties getting displayed under ‘Description properties’ are those properties which are
configured in Normal Identification. If Smart identification process is enabled, then the value for
that is displayed as ‘True’.



3. Ordinal Identifier:

There are three types of Ordinal Identifiers in QTP:

a. Index
b. Location
c. Creation time

If QTP is unable to identify an object uniquely based on the properties mentioned in Normal and Smart identification sections, then it goes to Ordinal Identifier section

a. Index:
QTP assigns a value while recording to each and every object from source code. Assigning values is object-specific. That is if there are 5 edit boxes, 6 radio buttons and 7 check boxes in the source code of the page, then indexing will be separate for edit boxes, radio buttons and checkboxes. And indexing count starts from 0. That is in the above example firs edit box in the source code will have an index 0 and last edit box in source code will have an index 4.
b. Location:

QTP assigns a value while recording based on the location of object for unique identification. Assigning the values is Object specific. The value is based on the order, in which the object appears within the window, frame, or dialog box, in relation to other objects with identical properties. Values are assigned in columns from top to bottom, and left to right. Location count will start from 0. That is the first object in the window will have a location value 0.
See the below example to understand the values assignment to the objects.

c. Creation Time:
Creation time identifier is specific to Browser objects only. QTP assigns a value while recording based on Creation Time object property. This identifier is useful when there are multiple browsers with similar objects. QTP identifies the session start time and assigns a vale to it. Creation time value count starts with 0. For example when there are three browsers opened, then the browser that is opened initially will be assigned 0 and the browser that is opened last will have a value 2 assigned.
The question that gets raised here is, why not all the properties are selected in the same section?
All the properties can also be selected in the same section. But the negative results of this will be, every time when QTP records an object it records and stores the information of all the properties that are mentioned in mandatory as a result of which there would be more memory utilization. And while execution also QTP will verify all the properties that are stored which will result in time delay while execution.
Reference: Quick test Users guide - Configuring Object Identification

No comments:

Post a Comment