--> Object Repository Types

An object as we know is a graphic user element in an application e.g. a button or a list or an edit box and the special characteristics of an object within the Quickest are called Object Property. QTP stores the recorded object properties in Object Repository.
There are 2 types of Object Repositories.
1. Per Action Object Repository (Default)
Extension of the file is .mtr (Module Test Repository)
2. Shared Object Repository
Extension of the file is .tsr (Test Shared Repository)
Per Action Object Repository: A QTP test is a collection of one or more actions and each action maintains its own Object Repository which is called Per Action Object Repository.

Shared Object Repository:
In case of Shared Object Repository, we create one single object repository file and share it among multiple.
Steps to create Per Action Object Repository:
1. Open a new script in QTP. (By default each test will have one action i.e, Action1)
2. Ensure that the record and run settings are provided.
3. Click on record button
4. Record the script for Action1
5. Select insert --> Call to new Action
6. Provide the action name and description
7. Click on OK
8. Record the script for Action2
9. Repeat the above 4 steps to create multiple actions.
10. Click on stop recording
Note: Per Action Object Repository can be changed as Shared Object Repository but not vice-versa.

Object Repository Window Menu Options:
This option is used to export the contents of an actions object repository to an external file (Shared file), so that other team members can use it.
1. Select resources -> Object Repository or Click on Object Repository icon or Ctrl+R
2. Select the required action from the drop down
3. Select the file
4. Export local objects
5. Navigate to required location in the system to save.
6. Save the file. (File will be saved with .tsr extension)

Edit (General)
Test Object: An object learned by QTP and maintained in Object repository file is called Test Object.
Run Object: An object from the AUT against which the script needs to execute is called Run Object.
Note: A test execution will be successful if the test object info and run object information is same. Otherwise it will fail.
Object -> Define New test Object:
This option is used to define a new object in the Object repository file by providing name & descriptions manually
Object -> Add objects to Local
This option is used to add a new object in the Object repository file by selecting/ clicking the object on the AUT.
Steps to Add Object to Object Repository file:
1. Ensure that the application is available
2. Select Object -> Add objects to Local
3. Take the hand icon
4. Click on the required object
5. To add all the objects of the parent, Click on the Parent Object
Object -> Update from Application:
This option is used to update the existing information in the modified AUT.
1. Select the required object to update in the Object repository file
2. Select Object -> Update from AUT
3. Take the hand
4. Click on the required objects

View -> Highlight in AUT
This option is used to high light the object on the AUT when an object is selected in the object repository
1. Select an object in Object Repository
2. Select View -> Highlight in AUT

View -> Locate in repository:
This option is used to locate the objects information in the repository file for the corresponding object on the AUT
1. Select View -> Locate in Repository
2. Take the hand icon
3. Click on the required object on AUT (the corresponding object is automatically selected in the object repository file)