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 use of object spy.
It is very important for the tester to know about be 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 in the following three parts including this article:
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. Run time 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 gets involve with that particular action. When any changes we do with an object of a shared object repository, will automatically reflect to 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.
In some situation, we get series of objects with same class name and properties. Suppose, UFT window has series of check boxes 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 specifies its location or order in a group. This value helps UFT to identify objects when the inbuilt properties are NOT sufficient to do so.
UFT supports 3 Ordinal Identifiers,
- Creation Time
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,
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,
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 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.
Don’t Miss Another Article on UFT/QTP
Join over 10,000 people who get FREE and fresh content from this Blog.
We Respect Privacy, You’re Safe! No Spam!
Other Tutorial Series
Must Read Articles For You: