This is UFT training tutorial article 8 where we will talk about the one of the key part UFT called “Object Repository in UFT”. In this article we are seeing What is Object Repository, Types of Object Repository, useful objects and features supported by Object Repository and What is the use of object spy.
It is very important for the tester to know about being able to have a basic programming skill
The Object Repository in UFT is more vital part in UFT/QTP, so we are dividing the Object Repository articles into the following three parts including this article:
8] Object Repository in UFT – How UFT identify the objects uniquely?
8.1] Object Repository Exercise 1 Learn and Save Objects of a web application
8.2] Object Repository Exercise 2 Learn and Save Multiple Object Repositories
An object repository is a storehouse or hub for the test objects (and other object types) and properties used in the test. During recording process under test, all objects and its properties records, automatically. These objects and properties play a vital role in UFT, without these two things UFT could not play back the scripts. Runtime objects are stored representations objects values and properties, used by UFT to run the test.
Types of Object Repository:
UFT stores test objects in following types of object repository files,
- Shared object repositories. Test objects that store in this repositories used by multiple actions. This flexibility makes it the ideal repository type for storing and preserving test objects. When we involve shared object repository with an action, the test objects of the repository automatically get involved with that particular action. When any changes we do with an object of a shared object repository, will automatically reflect all steps of the action to which object is associated
- Local object repositories. Test objects that store in this repositories used in one specific action. The objects stored in this type of repository cannot be used in any other action. The repository is useful for backing up your test objects, or for learning new objects.
These are some major difference between Local Object Repository (LOR) and Shared Object Repository (SOR):-
Local Object Repository(LOR) | Shared Object Repository (SOR) |
This Object Repository delivers only one test object for one action. | This Object Repository delivers multiple test objects for multiple actions. |
By default, it’s always being available for each and every test. | Usually, it is used in frameworks as re-usability and maintainability. |
The LOR can be modified in Object Repository. | It is read only by default, but can be modified in Object Repository Manager. |
Difficult to edit, because it is not a standalone file. | Easy to edit, because it is a standalone file. |
It uses .bdb extension for file saving. | It uses .tsr extension for file saving. |
It Should be used when many tests does not work on the same screens of the application under test. | It Should be used when different scripts interact with the same type of the object. |
Some useful objects and features supported by Object Repository
Save Object Repository into XML format:
To reduce the size of Object Repository, save it in XML format. User can export and import same or different object repository into XML format, using this process. The Same object repository can be imported from XML and can be edited/deleted and exported back to XML.
To do so, open Shared object Repository Window, go to File > Export to XMLor Import to XML as shown below,
Compare Object Repositories using Comparison Tool:
Object repositories can be compared using Object Repository Comparison Tool. This comparison is helpful for users to see two different object repositories objects, properties and their values, to decide which repository is helpful for test.
To get this tool, goto Resources > Object Repository Manager.
Form Object Repository Manager window, access Tools > Object Repository Comparison Tool.
The Object Repository comparison Window opens, here user has to choose two Object Repository files for comparison and click on OK.
It shows the Comparison and displays the differences one by one as shown below.
Close the “Comparison Statistics”.
Next, after closing “Comparison Statistics”, click on “Filter” button. Filter dialog box opens with three parameters- unique objects, identical objects, and partial match objects.
Confirm that all three options should be selected.
Merging Object Repositories
Some time, it becomes necessary to merge object repositories with each other. In this case, object repository adds additional overheads.
In UFT, go to Resources > Object Repository Manager. In the opened Object Repository Manager window, go to Tools > Object Repository Comparison Tool.
The Object Repository Merge Window opens. Here, select two Object Repository files for merge and click OK.
Next, Merge Statistics shows with conflicts and merge summary, shown in the figure below.
Close the Merge Statistics dialog box.
Display objects and their properties by using filter options; show all objects, or show only conflicting objects.
Choose show only conflicting objects in this case.
Ordinal Identifiers:
In some situation, we get series of objects with same class name and properties. Suppose, UFT window has series of checkboxes with the same set of properties and user wants to work on those objects, first they have to uniquely identify them then only UFT will be able to act on it.
Here, an Ordinal Identifier works; it gives a numerical value to test objects that specify its location. This value helps UFT to identify objects when the inbuilt properties are NOT sufficient to do so.
UFT supports 3 Ordinal Identifiers,
- Index
- Location
- Creation Time
Index:
An object that comes first in the UserIdentity1, has smaller Index value and an object that comes last, has highest Index value.
Index value of Text boxes will be as follows,
Location:
The Location shows values vertically from top to bottom and from left to right. That’s why; in some situation, location value for the group of text boxes will look like as follows,
Creation Time:
When two browsers open same web based application, UFT does not identify the window as both windows have the same set of properties. In this case, the Creation Time becomes very much helps for UFT.
User Defined Objects:
In UFT, the application does not use Standard Windows Classes when objects identification confuses to users. UFT interface uses Class Name to discovery the type of Object and sometime these object can be shown as a button or Combo Box etc. When we add the button object displays as Winobject.
To get this WinObject, go to Tools > Object Identification.
When Object Identification dialog box opens, from Environment drop down box select “Standard Windows” then click on “User Defined” button.
Note: This option won’t work against any other environment.
In the below example, an object of a specific class is made to identify as an object of Type “button”. Hence this object inherits all properties of a button and we can use the objects that are supported by button.
Object Spy:
Object Spy is a utility/option used to add objects to the Object Repository. Object Spy can be retrieved from the tool bar, as shown in the figure below,
Once user clicks on the Object Spy icon, the Object Spy Dialog box opens. Here, click on pointing hand to add objects in the repository.
After Spying the object in the Object Spy dialog box, Object Spy displays the object hierarchy with the Object_Class and Object_Name, and also displays the properties and values of the object shown in the figure below.
Object Spy’s “Highlight” option highlight the particular object of which object Spy displays the information. To check this feature, click on “Highlight”, it will take you to that particular object of the application. The given below figure shows the highlighted part of the application, comes after clicking on “Highlight” option.
To add the object into the Object Repository, need to click on “Add objects” button in the Object spy dialog.
Properties and values display of particular object in the dialog box should be unique for UFT to identify the objects while the script executes.
⇓ Subscribe Us ⇓
If you are not regular reader of this website then highly recommends you to Sign up for our free email newsletter!! Sign up just providing your email address below:
Happy Testing!!!
Other Tutorial Series
- Object Repository Exercise 1: Learn and Save Objects of a web application – UFT/QTP Training Tutorial 8.1
- Object Repository Exercise 2: Learn and Save Multiple Object Repositories – UFT/QTP Training Tutorial 8.2
- Overview of HP Unified Functional Testing 12.0 – UFT/QTP Training Tutorial 3
- Type of Testing in Unified Functional Testing (UFT) 12.0 – UFT/QTP Training Tutorial 6
- Add steps on Login action in keyboard View – UFT/QTP Training Tutorial 10
- Exercise3: Add Steps to the BookFlight Action Using the Step Generator – UFT/QTP Training Tutorial 10.2
- Brief Overview of Keyword View – UFT/QTP Training Tutorial 11
- UTF 12.0 First Look After Installation – UFT/QTP Training Tutorial 4
- UFT Functions and Function Libraries – UFT/QTP Training Tutorial 9
- Exercise2: Brief explanation of how Keyword view works – UFT/QTP Training Tutorial 11.3
1 thought on “Object Repository in UFT – How UFT identify the objects uniquely? – UFT/QTP Training Tutorial 8”
greate article..