Tuesday 14 May 2013

Object Repository in QTP


Overview

Whenever you record a test, QTP adds each and every objects to the Object repository on which you perform an operation.It is very important to understand that if you want to do a operation on certain objects, those need to be in object repository (Else one need to write Programmatic description).One can also add
test objects to the local object repository while editing your test.

There are two types of object repositories— Local object repository and a Shared object repository

A local object repository stores objects in a file that is associated with one specific action, so that only that action can access the stored objects.

A shared object repository stores objects in a file that can be accessed by multiple tests (in read-only mode). You can use the same shared object repository for multiple actions. You can also use multiple object repositories for each action. 

Tests always use the object repositories that are specified in the Associated Repositories tab of the Action Properties dialog box or in the Associate Repositories dialog box. Shared object repositories are read-only when accessed from tests; you edit them using the Object Repository Manager.

One should use Local Object Repository in following cases-

1-You are creating single-action tests.
2-You have very few tests to automate.
3-You do not expect to frequently modify object properties.
4-You are new to using QuickTest and simply wants objects to be added automatically in a local object repository by recording.


One should use Shared Object Repository in following cases-

1-You are creating tests by not using recording.
2-If you are using modular approach.
3-You often work with multi-action tests and regularly use the Insert Copy of Action and Insert Call to Action options.
4-You expect the object properties in your application to change from time to time and/or you regularly need to update or modify object properties.
5-If you are proficient, it is probably most efficient to save objects in a shared object repository. In this way, you can use the same shared object repository for multiple action, if the actions include the same objects.
6-Where same objects are being required in multiple tests, creating a shared object repository will help in maintenance of objects. When the objects in your application change, you can update them in one location for all the actions that are using this shared object repository.


How QuickTest determines the object to use when an object with the same name exists in multiple object repositories

➤ If an object with the same name is located in both the local object repository and in a shared object repository associated with the same
action, the action uses the local object definition.
➤ If more than one shared object repository associated with the same action, the object definition is used from the first occurrence of the
object, according to the order in which the shared object repositories are associated with the action. 

Exporting Local Objects-

Go to Resources->Object repository
File->Export Local Objects




Associating an Object Repository to your test

Go to Resources->Object repository
Click on Associate Repository button and then click on "+" sign to add repository
Select the repository and click on Open






After adding select the action from Available and add it to Associated Actions and click OK









No comments:

Post a Comment