Object Repository in UFT or QTP

0
69
Spread the love
  • 29
  • 34
  • 28
  • 35
  •  
  •  
  •  
  • 12
  •  
  •  
    138
    Shares

Object Repository in UFT or QTP
Object Repository in UFT or QTP

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.

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.

Object:

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.

Software objects:

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.

  1. Run time objects
  2. Test objects
  3. Utility objects
  4. 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:

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.
Note:
Test objects names vary from one environment to another.
Ex:

Run time objects Test objects in Windows Environment Test objects in VB
Environment
Test objects in web Environment
buttons WinButton VBButton WebButton
Edit box WinEdit VBEdit WebEdit
Checkbox Wincheckbox Vbcheckbox Webcheckbox

 

Utility objects

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.

Ex:

  1. SystemUtil for launching/closing the application.
  2. The reporter for defining results.
  3. Services for inserting transaction points
  4. 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:

  1. Click on Tool.
  2. Click on Object Identification.
  3. Object Identification window activates.
  4. Select Environment as a standard window.
  5. Click on User defined.
  6. Let the object mapping window open.
  7. Click on the class name or use hand symbol to identify the object.
  8. Click on the Map to drop down to select any other control.
  9. 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.

  1. Local repository (.MTR extension-Module Test Repository )
  2. Shared repository(.TSR extension- Test Shared Repository)
Local 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?

  1. Open any test
  2. Navigate to Resource
  3. Click on Object Repository(Shortcut Ctrl+R)
Locate local Object repository
Locate local Object repository
  • 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.

Export OR to XML
Export OR to XML

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:

  1. Name- Object Identifier- Name of the object
  2. ClassName- Object Class name coming from add-ins or UFT/QTPs class selection mechanism. This field is uneditable.
  3. Repository- Local- The location of the Object Repository. This field is uneditable too. It just tells where the object is in the repository.

Now the lower pane shows the Object details:

Description Properties:

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.

  •    NativeClass-Edit
  •    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
  • Comment

Advantage of local object repository:

  1. It is not an overhead.
  2. Very Fast.
  3. Object conflict will not occur.
  4. Objects can be edited from the repository only

The drawback of local object repository:

  1. Difficult to maintain
  2. 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
OR Filter to add object
OR Filter to add object

You may also get three options to filter from

  1. Only selected object(adds the selected object)
  2. Selected Object and its all its direct children
  3. 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:

  1. Click on Resources
  2. Click on Object repository
  3. Select the object which you want to rename
  4. Right click on that object
  5. Rename
  6. Type the correct name
  7. Select some other object

It will automatically rename the previous object.

Object Repository view Local
Object Repository view Local
How to delete objects from Object repository?

We can delete the object in the object repository. Navigation will be as below:

  1. Click on Resources
  2. Click on Object repository
  3. Select the object which you want to delete
  4. Right click on that object
  5. Click delete
  6. Click on confirm delete option
  7. Close repository.
Don't miss out!
Subscribe To Newsletter

Receive top technical news, lesson ideas, travel tips and more!

Invalid email address
Give it a try. You can unsubscribe at any time.

Spread the love
  • 29
  • 34
  • 28
  • 35
  •  
  •  
  •  
  • 12
  •  
  •  
    138
    Shares

LEAVE A REPLY

Please enter your comment!
Please enter your name here