To start the discussion on the Object Identification Mechanism in QTP first we need to understand that we have two broad classification of the objects with reference to the QTP : Test Object and Run Time Object.
Test Object :: A test object is an object which is created by the QTP to represent an actual object in the application under test. Ideally, a test object consists of all the properties which are sufficient to uniquely replicate an actual object in the application on which we want to perform some operation.
Run Time Object :: While a run time object is the actual object in the application under test on which we want to perform some operation as a part of our testing.
When QuickTest learns an object in your application, it adds the corresponding test object to an object repository, which is a storehouse for objects. When you add an object to an object repository, QuickTest:
➤ Reads the current value of the object’s properties in your application and stores the list of identification properties and values with the test object.
➤ Chooses a unique name for the test object, generally using the value of one of its prominent properties.
When you run a test, QuickTest identifies each object in your application by its test object class and its description (the set of identification properties and values used to uniquely identify the object). The list of test objects and their properties and values are stored in the object repository. For each test object class, QuickTest learns a set of identification properties. When it learns an object, and selects a sub-set of these properties to serve as a unique object description. QuickTest then uses this description to identify the object when it runs the test.
When the test runs, QuickTest searches for the object that matches the description it learned. If it cannot find any object that matches the description, or if it finds more than one object that matches, QuickTest may use the Smart Identification mechanism to identify the object.
You can configure the mandatory, assistive, and ordinal identifier properties
that QuickTest uses to learn the descriptions of the objects in your
application, and you can enable and configure the Smart Identification
In a typical normal process, If the mandatory property values are not sufficient to uniquely
identify the object within its parent object, QuickTest adds some assistive
properties and/or an ordinal identifier to create a unique description.
Mandatory properties are properties that QuickTest always learns for a
particular test object class.
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 QuickTest 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.
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.
If the combination of all defined mandatory and assistive properties is
not sufficient to create a unique test object description, QuickTest also
learns the value for the selected ordinal identifier.
If a specific test object relies mainly on ordinal identifiers, you can also define Visual Relation Identifiers ( VRI ) for that test object, to help improve identification reliability for that object.
A visual relation identifier is a set of definitions that enable you to identify the object in the application according its neighboring objects in the application. You can select neighboring objects that will maintain the same relative location to your object, even if the user interface design changes.
When you run a test, QuickTest searches for the object that matches the
description it learned (without the ordinal identifier). If it cannot find any
object that matches the description, or if more than one object matches the
description, QuickTest uses the Smart Identification mechanism (if enabled)
to identify the object. In many cases, a Smart Identification definition can
help QuickTest identify an object, if it is present, even when the learned
description fails due to changes in one or more property values. The test
object description is used together with the ordinal identifier only in cases
where the Smart Identification mechanism does not succeed in narrowing
down the object candidates to a single object
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.
➤ A visual relation identifier is not defined for the test object.
The whole story is summarized in the below mentioned flowchart picked up from the QTP 11 help file :
Happy Reading . . !!
# Hims :)
Awesome post
ReplyDeleteobj.GetClass().GetDeclaredMethods()
ReplyDeletemethods.mic_arr_get_length - 1
methods.mic_arr_get(i).tostring