‘Repository’ is a generic term meaning a central location in which data is stored and managed. And why would someone need a central location? To access data from a single source of truth, which can be accessed across-locations by multiple users. Now apply the same concept to Automation.
Say you want to test multiple application flows wherein some objects are referenced in each flow. What does your logic say? Yeah! To have a central location of these objects & access it for different flows. Now what should this repository contain w.r.t. Automation Testing? Yeah, as you would have guessed – Objects & their properties so that UFT can refer repository to identify these objects during run-time.
A collection of objects and its properties with which QTP will be able to recognize the objects and act on it. These objects and properties play a vital role in UFT, without these two things UFT could not play back the scripts. When a user records a test, the objects and its properties are captured by default.
Object Repository Types
UFT stores test objects in following types of object repository files,
Local Object Repository
Applicable only for that Action. Local O-R is preferable when application is not dynamic with respect to time. These objects are stored within a “.BDB” file and the default file name will be “ObjectRepository.bdb”. As the name suggests these files are local to particular action and for each action there will be a separate “.BDB” file. This is the default OR in QTP. Resources >> Object Repository
Global / Shared Object Repository
Shared across actions/modules which would be mapped for two or more actions. Shared O-R is preferable when application is dynamic and object description change frequently. Resource >> Object Repository Manager
- Per Action VS. Across multiple actions
- Available for each test by default VS. Usually used in Frameworks
- Editable VS. Read-only by default (can be edited using OR Manager)
- Extension .bdb VS. .tsr
- Should be used when not many tests are working on the same screens of the application under test VS. Should be used when there are different scripts interacting with the same type of the object
One of the important aspects when planning your tests (or choosing a framework for your project) is to consider where and how you want your objects to be stored and how they have to be made available to the tester. To maintain ORs in your test there is a specialized Object Repository Manager that QTP provides. It can be accessed from the menu item “Resources->Object Repository Manager” (CTRL+R or Click on OR button).