QTP Smart Identification Explained

Posted on Jun 9 2008 - 8:00pm by Raj

Smart Identification is nothing but an algorithm used by QTP When the recorded definition for an object does not enable QuickTest to identify an object. 

QuickTest Pro SMART Identification
Smart Identification is nothing but an algorithm used by QTP When the recorded definition for an object does not enable QuickTest to identify an object. For example, A photograph of a 8 year old girl and a boy. QTP records identification properties of that girl when she was 8, now when both are 10 years old then QTP would not be able to recognize the girl. But there is something that is still the same that is there is only one girl in the photograph.

When QuickTest uses the recorded description to identify an object, it searches for an object that matches every one of the property values in the description. In most cases, this description is the simplest way to identify the object and unless the main properties of the object change, this method will work.

If QuickTest is unable to find any object that matches the recorded object description, or if it finds more than one object that fits the description, then QuickTest ignores the recorded description, and uses the Smart Identification mechanism to try to identify the object.

If QuickTest successfully uses Smart Identification to find an object, the test results receive a warning status and include the following information:

In the results tree:

In the results details:

A description mismatch icon for the

missing object.

An indication that the object was not

found.

A Smart Identification icon for the

missing object.

An indication that the Smart Identification mechanism successfully found the object,

and information about the properties used to find the object. You can use this information to modify the recorded test object description, so that QuickTest can find the object using the description in future run sessions.

The actual step performed.

Normal result details for the performed step.

 

The Smart Identification mechanism uses two types of 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 as they are unlikely to change on a regular basis, but which can be ignored if they are no longer applicable.

If QuickTest activates the Smart Identification mechanism during a test run (because it was unable to identify an object based on its recorded description), it follows the following process to identify the object:

1. QuickTest forgets the recorded test object description and creates a new object candidate list containing the objects (within the object’s parent object) that match all of the properties defined in the base filter property list.

2. From that list of objects, QuickTest filters out any object 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 step 2 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 step 2 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.

4. QuickTest continues the process described in steps 2 and 3 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 recorded description plus the ordinal identifier to identify the object.

If the combined recorded description and ordinal identifier are not sufficient to identify the object, then QuickTest stops the test run and displays a Run Error message.

When should I use SMART Identification?

Something that people don’t think about too much. But the thing is that you should disable SI while creating your test cases. So that you are able to recognize the objects that are dynamic or inconsistent in their properties. When the script has been created, the SI should be enabled,
so that the script does not fail in case of small changes. But the developer of the script should always check for the test results to verify if the SI feature was used to identify a object or not. Sometimes SI needs to be disabled for particular objects in the OR, this is advisable when you use SetTOProperty to change any of the TO properties of an object and especially ordinal identifiers like index, location and creation time.

How can I disable Smart Identification

you can disable Object Recognition’s Enabled Smart Identification for EACH Web object using the Tools->Object Identification dialog.

Also you can use the following code in the init-function:

‘###

Set App = CreateObject("QuickTest.Application")

App.Test.Settings.Run.DisableSmartIdentification = True

‘###

or

‘###

Setting("DisableSmartIdentification") = True

‘###

About the Author

Leave A Response