QTP Object Repository

QTP Object Repository:

  1. When QuickTest runs a component, it simulates a human user by moving the pointer over the application, clicking objects, and entering keyboard input. Like a human user, QuickTest must learn the interface of an application to be able to work with it. QuickTest does this by learning the application’s objects and their corresponding property values and storing these object descriptions in an object repository. 
  2. Select Resources > Object Repository… or click the Object Repository button.

 For each test object you select in the tree, the Object Repository window displays information on the test object, its type, the repository in which it is stored, and its test object details.

Test Object Details

  1. Description properties The properties and property values used to identify the object during a run session. You can add and remove properties to or from the test object description.
  2. Ordinal identifier A numerical value that indicates the object’s order or location relative to other objects with an otherwise identical description (objects that have the same values for all properties).
  3. Additional details Contains the following options:

                    – Enable Smart Identification. Enables you to select True or False to specify whether QuickTest should use Smart Identification to identify the test object during the run session if it is not able to identify the object using the test object description.

                   – Comment. Enables you to add textual information about the test object.

Object Repository Advantages
 

  1. Allows separation of physical attributes from the test scripts (simplifies test scripts)
  2. Allows QTP to uniquely identify objects in the AUT using physical attributes
  3. Allows QTP to refer to an object using “Names”
  4. Provides the connection between Names and physical attributes
  5. Maintainability – if a button label changes in the application you do not need to edit all the scripts
  6.  Readability of scripts is improved with the usage of Names
  7. Portability – use the same script with different Object Repository for each platform

Object Repository Types

  1. Test objects can be stored in two types of object repositories—a shared object repository and a local object repository.
  2. A shared object repository stores test objects in a file that can be accessed by multiple components (via their application areas) in read-only mode.
  3. A local object repository stores objects in a file that is associated with one specific component, so that only that component can access the stored objects.

Deciding Whether to Use Local or Shared Object Repositories

• In general, the local object repository is easiest to use when you are creating simple record and run components, especially under the following conditions:

             – You have only one, or very few, components that correspond to a given application, interface, or set of objects.

             – You do not expect to frequently modify test object properties.

• Conversely, the shared object repository is generally the preferred option when:

            – You are creating components using keyword-driven methodologies (not using record).

            – You have several components that test elements of the same application, interface, or set of objects.

           – You expect the object properties in your application to change from time to time and/or you regularly need to update or modify test object properties.

Understanding the Local Object Repository

• When you use a local object repository, QuickTest uses a separate object repository for each component. (You can also use one or more shared object repositories if needed. The local object repository is fully editable from within its component.

• When working with a local object repository:

    – QuickTest creates a new (empty) object repository for each component.

     – As you record operations on objects in your application, QuickTest automatically stores the information about those objects in the corresponding local object repository (if the objects do not already exist in an associated shared object repository).

  – QuickTest adds all new objects to the local object repository even if one or more shared object repositories are already associated with the component. (This assumes that an object with the same description does not already exist in one of the associated shared object repositories).

    – If a child object is added to a local object repository, and its parents are in a shared object repository, its parents are automatically moved to the local object repository.

     – Every time you create a new component, QuickTest creates a new, corresponding local object repository and begins adding test objects to the local object repository as you record or learn objects.

     – If you learn or record on the same object in your application in two different components, the object is stored as a separate test object in each of the local object repositories.

    – When you save your component, the local object repository is automatically saved with it. The local object repository is not accessible as a separate file (unlike the shared object repository).

Understanding the Shared Object Repository

• When you use shared object repositories, QuickTest uses the shared object repositories you specified for the selected component’s application area. You can use one or more shared object repositories.

• After you begin creating your component, you can specify additional shared object repositories. You can also create new ones and associate them with your component. Before running the component, you must ensure that the object repositories being used by the component contain all the objects in your component. Otherwise, the component may fail.

• You modify a shared object repository using the Object Repository Manager.

• When working with a shared object repository:

– If you record operations on an object that already exists in either the shared or local object repository, QuickTest uses the existing information and does not add the object to the object repository.

– If a child object is added to a local object repository, and its parents are in a shared object repository, its parents are automatically moved to the local object repository.

– QuickTest does not add an object to the shared object repository as you record operations on it. Instead, it adds new objects to the local object repository (not the shared object repository) as you learn objects or record steps on them (unless those same objects already exist in an associated shared object repository).

• You can export the local objects to a shared object repository.

• You can also merge the local objects directly to a shared object repository that is associated with the same component. This can reduce maintenance since you can maintain the objects in a single shared location, instead of multiple locations.

Comments