The post will cover the following topics Details of Object Repository in UFT,Details of Object Repository in QTP,add object repository in QTP,add object repository in uft,what is object repository in qtp explain,what is object repository in UFT explain,object repository in qtp with examples,object repository in UFT with examples,Object Repository in UFT,Object Repository in QTP. Apart from these you will also able to learn how to work export object repository to Excel and Automatic Object model to handle Object Repository.
It is a storage place of UFT or QTP where we can store the objects information those are required for testing and it also acts as the interface between the test script and the AUT in order to identify the objects during execution.
So Object repository is a collection of objects and their properties. As it acts as an interface, with these properties QTP/UFT will be able to be to identify the objects and work on them. Similarly, if UFT/QTP cannot identify the objects, it will not be able to work on these objects.
In a simple term, an object is a graphic user element in an application and object repository is a graphical representation of the objects.
The object is something, which has structure and properties. Mostly this concept is based on OOPs hierarchy of Objects..It consists of data that describes the object [properties] and Functions that can be performed on that object[methods].
In OOPs an object is an instance of a class and in QTP or UFT, the objects are defined by the class. Like a go button in web, context is an instance of a web button.
We call windows, WebPages, buttons, edit boxes, check boxes, etc.. as software objects.
Types of Object in QTP:
There are four types of object available in QTP.
- Run time objects
- Test objects
- Utility objects
- Automation objects/User defined objects.
Run time objects:
During execution, the actual objects are called Runtime objects. The runtime objects are not present in the object repository. The objects present in the AUT. Ex: Buttons, links, etc…This is another important thing to learn on object repository in UFT with examples.
Test objects are the replica of the actual objects(or controls) fetched from the application under test. It can be said test objects are references of Run time objects. They are UFT/QTP’s representation of the objects. This is another important thing to learn on object repository in UFT with examples.
Ex: WinEdit, WinButton, WebButton, Link, etc.
Test objects names vary from one environment to another.
|Run time objects||Test objects in Windows Environment||Test objects in VB
|Test objects in web Environment|
They are QTP/UFT reserved objects used for testing and result reporting. This is another important thing to learn on object repository in UFT with examples.
- SystemUtil for launching/closing the application.
- The reporter for defining results.
- Services for inserting transaction points
- Environment for using environment variables
Automation objects/User defined objects
User can create objects; those can be used for performing specific operations. Ex: Creating objects in file system object class, adodb.connection class, dictionary object class, excel. Application class etc. This is another important thing to learn on object repository in UFT with examples.
More on User-defined Object:
If UFT/QTP refuses to recognize an object from the application(maybe standard classes does not support the object), UFT/QTP, in that case, will recognize the object as WinObject.
It is different than the common convention that you need to open UFT/QTP first then the application, otherwise, UFT/QTP will not be able to recognize the general objects and they will be identified as WinObjects.
The second reason why you may go to user-defined objects is that we want UFT/QTP to work an object just like another object. Like if we want to use combo box as button or link or any other control.
Navigation to create user-defined objects in UFT/QTP
- Click on Tool.
- Click on Object Identification.
- Object Identification window activates.
- Select Environment as a standard window.
- Click on User defined.
- Let the object mapping window open.
- Click on the class name or use hand symbol to identify the object.
- Click on the Map to drop down to select any other control.
- Click on add to create one more or click on OK to close the Object Mapping
This is how you create user-defined objects in UFT/QTP.
In general, there are two types of repository available in QTP/UFT
- Local repository (.MTR extension-Module Test Repository )
- Shared repository(.TSR extension- Test Shared Repository)
For each action based test, the UFT will create and manage the individual repository. It is good when the test is small. It is local to test action. It is automatically saved in a test whenever we record a test. It resides in the bdb folder in action subfolder.File extension is .mtr(modular test repository). As this is local to any action, it can not be used for any other action or test. By default, QTP/UFT saves its objects to the local repository. This is another important thing to learn on object repository in UFT with examples.
How to locate the Local Object Repository?
- Open any test
- Navigate to Resource
- Click on Object Repository(Shortcut Ctrl+R)
- QTP/UFT creates a Local Repository for every action automatically during Recording. That cannot be shared among tests.
- User can add some more objects to Local repository
- User can perform rename, delete operations in the local repository. As it is QTP/UFT’s internal file, the user no need to save modifications. In other words, it is auto-saved.
- User can have multiple shared object repositories along with local object repository.
- You can export the local object repository to the shared object repository.
In case if your test has shared object repository and local object repository attached to it, If you add a child object to local object repository and the parent of that object stays in the shared object repository, UFT/QTP will automatically move the parent to the local object repository.
If you add the same object from your application to two different actions, UFT will treat them differently as each action has its own local repository.
Components of Local object Repository
If you open the Local object Repository, the first thing you notice the action drop down. As the local object repository is a private property of an action, you have to select an action to catch hold of the respective object repository.
Once you have selected the Action, you will get the test object tree. The lowest element of the tree is often referred to as an object. In general, every node of the tree is an object. Once you click on any node, you will get the object properties in the right-hand side.
The Object details pane will have:
- Name- Object Identifier- Name of the object
- ClassName- Object Class name coming from add-ins or UFT/QTPs class selection mechanism. This field is not editable.
- Repository- Local- The location of the Object Repository. This field is not editable too. It just tells where the object is in the repository.
Now the lower pane shows the Object details:
Each object comes with mandatory properties and assistive properties. By default UFT/QTP provides some properties here, but we can customize this as per our need.
- Attached Text- The attached text retrieved from the application.
Visual Identifier- You can use it to enhance the object identification. That may reduce the chance to wrong object identification. This can be used to identify the object relative to other nearby objects.
- Visual relation Identifier- Visual Identifier or visual relation identifier settings
- Ordinal Identifier- Ordinal Identifier if any- mostly Type and value
- Additional details- Enable smart identification
Advantage of local object repository:
- It is not an overhead.
- Very Fast.
- Object conflict will not occur.
- Objects can be edited from the repository only
The drawback of local object repository:
- Difficult to maintain
- The duplicate entry of Objects to a repository is possible.
How to add objects to the local repository?
You can record while interacting with the application, UFT/QTP will automatically add objects to the Object Repository. You can also add objects manually to the Object Repository.
How to Navigate:
- Click Resource
- Click on Object Repository
- Click on Objects
- Click on Add objects to Local
- Show the object
- Click ok
You may also get three options to filter from
- Only selected object(adds the selected object)
- Selected Object and its all its direct children
- Selected Object and all its descendants
How to add Objects repositories to an action?
if we miss to add object during recording time but we need that we can add objects using add object feature. We can also work with object spy to identify the required object.
How to rename the object in the local object repository?
We can rename the object in the object repository. Navigation will be as below:
- Click on Resources
- Click on Object repository
- Select the object which you want to rename
- Right click on that object
- Type the correct name
- Select some other object
It will automatically rename the previous object.
How to delete objects from Object repository?
We can delete the object in the object repository. Navigation will be as below:
- Click on Resources
- Click on Object repository
- Select the object which you want to delete
- Right click on that object
- Click delete
- Click on confirm delete option
- Close repository.