Object Identification in running session
Object Repository Dialog box
In the Object Repository window, choose Object--> Add Objects to Local. Click the object you want to add to your object repository.
If the object is associated to any other object then you will this dialog box.
Selected object only: - Adds to the object repository the previously selected object's properties and values, without its descendant objects.
Default object types: - Adds to the object repository the previously selected object's properties and values, with the properties and values of its descendant objects according to the object types specified by the default filter. You can see which objects are in the default filter by clicking the Select button and then clicking the Default button.
All object types: - Adds to the object repository the previously selected object's properties and values, together with the properties and values of all of its descendant objects.
Selected object types: - Adds to the object repository the previously selected object's properties and values, as well as the properties and values of its descendant objects according to the object types and classes you specify in the object filter. You specify the objects and classes in the filter by clicking the Select button and selecting the required items in the Select Object Types dialog box.
Click on the select button to select the objects. After clicking on select this dialog box will open.
Select the filter type and add the objects to the repository.
Modifying properties of the objects
Select the object which you want to modify properties and go to description properties there select the property value. Automatically the property value will be edit; you can change that value to any value.
Changing name of the object
Select object in repository, right click-->Rename and change the name.
Deleting objects from repository
Select object in repository, right click-->Delete.
Select object in repository View --> Highlight in Application. This will highlight object in application.
Locate in Repository
Go to View --> Locate in Repository and select object in application if object is there in repository then that object will be selected.
Navigation: - Tools-->object spy
Using the Object Spy, you can view the run-time or test object properties and methods of any object in an open application. You use the Object Spy pointer to point to an object. The Object Spy dialog box displays the selected object's hierarchy tree. It displays the run-time or test object properties and values of the selected object in the Properties tab. It displays the run-time or test object methods associated with the selected object in the Methods tab.
To use object spy Click on the hand button showing in up side and show the object to that hand button Quicktest will automatically displays properties of that object.
Tip: - Hold Left ctrl key for navigating on the application after clicking on the hand button.
By default object spy will show the runtime object properties for web application but not for window applications.
Object Identification Dialog box
Navigation: - Tools--> Object Identification
It is mainly deals with how QTP is recording objects and properties to object repository.
- Configure the properties for each class
- Selecting the Ordinal Identifier
- Configuring smart identification
- Creating user defined classes
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.
If the combination of all defined mandatory and assistive properties is not sufficient to create a unique test object description, QuickTest also records the value for the selected ordinal identifier.
In general, there are two types of ordinal identifiers:
Index—indicates the order in which the object appears in the application code relative to other objects with an otherwise identical description.
Location—indicates the order in which the object appears within the parent window, frame, or dialog box relative to other objects with an otherwise identical description. Values are assigned from top to bottom, and then left to right.
The Web Browser object has a third ordinal identifier type:
CreationTime—indicates the order in which the browser was opened relative to other open browsers with an otherwise identical description. Each test object class has a default ordinal identifier selected.
Configuring Mandatory properties
In object identification dialog box select the object class from test object classes list and go to Mandatory properties for that class.
Click on Add/Remove button and select or deselect the properties you want to configure.
Configuring Assistive Properties
In object identification dialog box select the object class from test object classes list and go to Assistive properties for that class.
Click on Add/Remove button and select or deselect the properties you want to configure.
Configuring Ordinal Identifiers
To modify the selected ordinal identifier, select the desired type from the Ordinal identifier box.
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.
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
Optional filter properties—Other properties that can help identify objects of a particular class as they are unlikely to change on a regular
Understanding the Smart Identification Process
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.
If QuickTest successfully uses Smart Identification to find an object after no object matches the recorded description, the test results receive a warning status and include the following information:
Normal Identification fails to finds the object so that the warning message is showing.
If Quicktest uses Smart identification to find an object, a cap symbol will be appear in results where ever it is using.
And some description will show in results saying that how Quicktest identifies the object using smart identification.
In this example, Base filter properties prepares an objects list. (17 objects)
And optional filter properties filtered those object list using available properties.
If one property fails it’s using another property to find an object. If any property is finding one object QTP is ignoring other properties.
Where as in Normal Identification process all properties in object description should satisfied. If one property fails all object identification process will fail.
Configuring Smart Identification
In object identification window select a class in test object class list--> select option “Enable Smart Identification”--> Click on Configure
Then “Smart Identification Properties – class name” will be appearing…
Click Add/Remove to add or remove properties in Base and optional filter properties.
Note: - By default smart identification is configured and activated for web environment.
Mapping user defined test object classes
If your application has a button that cannot be identified, this button is recorded as a generic WinObject. You can teach QuickTest to identify your object as if it belonged to a standard Windows button class. Then, when you click the button while recording a test, QuickTest records the operation in the same way as a click on a standard Windows button. When you map an unidentified or custom object to a standard object, your object is added to the list of Standard Windows test object classes as a user-defined test object. You can configure the object identification settings for a user defined object class just as you would any other object class.
Note that an object that cannot be identified should be mapped only to a standard Windows class with comparable behavior.
For example, do not map an object that behaves like a button to the edit class.
Note: You can define user-defined classes only when Standard Windows is selected in the Environment box.
The Object Mapping dialog box enables you to map an object of an unidentified or custom class to a Standard Windows class.
To map an unidentified or custom class to a standard Windows class:
- Choose Tools > Object Identification. The Object Identification dialog box opens.
- Select Standard Windows in the Environment box.
- The User-Defined button becomes enabled. Click on User-Defined button. The Object Mapping dialog box opens.
- Click the pointing hand and then click the object whose class you want to add as a user-defined class. The name of the user-defined object is displayed in the Class Name box.
- In the Map to box, select the standard object class to which you want to map your user-defined object class and click Add. The class name and mapping is added to the object mapping list.
- If you want to map additional objects to standard classes, repeat steps 4-5 for each object.
- Click OK. The Object Mapping dialog box closes and your object is added to the list of Standard Windows test object classes as a user-defined test object.
- Note that your object has an icon with a red U in the corner, identifying it as a user-defined class.
- Configure the object identification settings for your user defined object class just as you would any other object class.
Object Identification - Conclusion