Wednesday, May 25, 2011

Object Repository

Object Repository is the collection of object properties used by QTP to identify the objects on the application .

Object repository is split into two components
1.Logical Name
2.Physical Description

Logical name is accomadated in script and repository to link script and repository.
Physical description is accomadated in repository to uniquely identify the objects.

Choosing the Object Repository Mode

The object repository per-action mode is easiest to use when you are creating simple record and run tests, especially under the following conditions


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

You do not expect to frequently modify test object properties

You generally create single-action tests

The shared object repository mode is generally the preferred mode when:


You have several tests 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

You often work with multi-action tests and regularly use the Insert Copy of Action and Insert Call to Action options

When working in object repository per-action mode:


QuickTest creates a new (blank) object repository for each action

As you record operations on objects in your application, QuickTest automatically stores the information about those objects in the appropriate action object repository

When you create a new action, QuickTest creates another new object repository and again begins adding test objects to the repository as you record



When you record on the same object in your application in two different actions, the object is stored as a separate test object in each object repository

When you save your test, all of the action object repositories are automatically saved with the test as part of each action within the test. The action object repository is not accessible as a separate file (as is the shared object repository)

Updating Test Objects in Object Repository Per-Action Mode


Modifying the test object properties, values, or names in one object repository does not affect the information stored for the same test object in another object repository or in other tests

If you parameterize objects in one action, the parameterization applies only to the objects in that current action

Splitting and Copying Actions in Object Repository Per-Action Mode


When you split an action in your test while using the object repository per-action mode:

QuickTest makes a copy of the action object repository

The two actions have identical object repositories containing all of the objects that were in the original object repository

If you add objects to one of the split actions, the new objects are added only to the corresponding action object reposit

When you insert a copy of an action into your test:


The copied action's action object repository is copied along with the action steps

You can edit the object repository of the copied action as you would any other object repository in the test

Understanding the Shared Object Repository Mode

When working in shared object repository mode: QuickTest uses the same test object from the shared object repository file when you record on the same object in two different actions or in different tests or components.


QuickTest adds new objects to the object repository as you record steps on the object

QuickTest uses the existing information and does not add the object to the object repository if you record operations on an object that already exists in the shared object repository (i.e. the object has the same test object description)




QuickTest saves changes to the shared object repository file when you save your open test or component or when you click Save in the Object Repository dialog box if the shared object repository is not locked and/or opened in read-only mode

Updating Test Objects in Shared Object Repository Mode


Shared object repository mode enables you to:

Easily maintain your tests or components when an object in your application changes

Manage all the objects for a suite of tests or components in one central location



When you modify the test object properties, names, parameterization settings, and so forth, in your shared object repository for an open test or component, QuickTest applies the change to all the tests or components that use the same shared object repository file

Parameterizing Test Objects in Shared Object Repository Mode


When you parameterize an object property in a shared object repository, there are several issues you should consider:

When you parameterize an object property (with any type of parameter), the change applies to all tests or components that already contain that object

When you parameterize an object property that is part of an object's description, and then record on the object in your application again, QuickTest creates a new test object in the shared object repository. This is because the description of the object in the object repository is not identical to the one in the application

Renaming Objects in a Shared Object Repository


If you rename objects in a shared object repository in one test or component and save the changes, when you open another test or component using the same shared object repository, that test or component updates the object name in all steps of the test or component. This process may take a few moments. If you save the changes to the second test or component, the renamed steps are saved.

However, if you close the second test or component without saving, then the next time you open the same test or component, it will again take a few moments to update the object names in the test or component steps

Splitting and Copying Actions in Shared Object Repository Mode .


When you insert a copy of an action into a test that uses a shared object repository, keep in mind:

Only the action itself is copied and not its corresponding object repository.

The copied action will use the same shared object repository as the test into which it is being copied.

When you insert copies of actions from tests using a different shared object repository or per-action repository mode, you must ensure that all the objects contained in the action are in the test's shared object repository. If the action uses objects that are not in the shared object repository, the test may fail


Choose Test > Settings > Resources tab


In the Object repository type area, select Per-action or Shared

If you selected Shared, specify the shared object repository file you want to use as the object repository file. To specify a file, enter the object repository file name or click the browse button and select a resource file from the Open dialog box. To create a new shared object repository file, enter a new file name in the Shared box

If you want to make your selection the default setting for new tests, click Set as Default

Click OK to save and close the Test Settings dialog box


Setting the Object Repository Mode


Consider the following when setting a default shared object repository file:


Any existing or open tests or components will not be affected by setting a different, default shared object repository file

All new tests or components will attempt to access your default shared object repository

If the shared object repository file's path is relative, QuickTest searches for the shared object repository file in the current test's folder and then in the Folders tab of the Options dialog box

It is recommended that you ensure that the path for the shared object repository is absolute or listed in the Folders tab of the Options dialog box


If you choose to set a file with a relative path or one that is in the current test's folder as the default shared object repository, QuickTest may not be able to locate the file when creating a new test

If the default shared object repository file is in Quality Center, you must be connected to Quality Center when you create a new test


 





No comments:

Post a Comment