Local & Shared Object Repository in QTP/UFT

What is Object Repository in QTP?

Object Repository is a collection of Test Objects and information that is recognized by QTP for working on it. When a user records a test, the objects and their properties are captured by default.

How Does Object Identification work in QTP?

  • HP QTP uses a “human” like technology for object identification
  • During Record, Time QTP tries to learn the properties of a GUI object on which operation is performed.
  • During Run-Time, Micro Focus UFT compares the stored object properties with actual properties of the object available on screen and uniquely identifies an object independent of its location on the screen
  • The stored object and together with its properties is called TEST Object
  • During Run-Time, the actual object available on the application under test is called Run-Time Object
  • This is Quick Tests “Test Object Model”
  • Information about the Test Objects is stored in Object Repository
  • Add-ins help in instructing Quick Test in advance of the nature of the object to be recorded so it as to reduce the time required to learn its properties

Learn Object Identification with an example in the following video

Click here if the video is not accessible

Types of Object Repository

There are 2 Types of Object Repository in QTP

  1. Local Object Repository
  2. Shared Object Repository

Local Object Repository

  • Local Object Repository is the default object repository
  • It is specific to actions and can be used only for a particular action
  • Local Object Repository is preferable when the application is not dynamic with respect to time
  • Local Object Repository cannot be reused
  • You can perform many operations in the local object repository such as –
  • Highlight an object stored in a repository on the application under test
  • Check whether a particular object in your AUT is stored in the Object Repository
  • Cut, Copy, Paste, Modify and Delete Objects
  • In case you have accidentally modified the value of a property you can update its description from the application using update function.

Shared Object Repository: Create, Associate, Edit

  • Global or Shared Object Repository is preferable when an application is dynamic and object description change frequently
  • Between Shared and local object repository, shared object repository is more commonly used in automation projects
  • However, it has maintenance and administration overheads as compared to local object repository.

To create and use a shared object repository you need to perform three broad steps

  • Creating a Shared Object Repository
  • Associating a Shared Object Repository
  • Editing a Shared Object Repository

Let’s look at them one at a time

Step 1) Creating a Shared Object Repository

  • All repositories are local by default. To create a Shared Object Repository, in the Object Repository Dialog Box, Click File > Export Local Objects
  • Repository files have an extension .tsr .Give a suitable name say “guru99” and save
  • The Shared Repository File is now created

Step 2)Associating a Shared Object Repository

  • Next step is to associate the repository to your test, which enables you to use it
  • To associate a repository with a test, Click Resources > Associate Repository
  • You can select the Repository to associate with Actions available in your test.
  • Now you can now use this shared repository to develop your test

Step 3) Editing a Shared Object Repository

  • You can use the Object Repository Manager to Edit a Share Repository.
  • Select Resources > Object Repository Manager. Open the Object Repository we created “guru99”
  • By Default, Repository is opened in Read-only mode. To enable editing click File > Enable Editing
  • Once editing is enabled you can all the operations like cut, copy, paste, rename objects etc that you can also do in Object Repository
  • Using the Object Repository Manager is you can compare two Object Repositories. QTP will give you a static’s of what’s unique and common in both the repositories
  • You can use the Object repository merge tool to merge two repositories into one