Username Password Remember Me Forgot your Password?

QTP object repository explained

HP Mercury QTP

Overview of Object Repository:

QTP Object Repository displays a tree of all objects in the current component or in the current action or entire test( depending on the object repository mode you selected). 
we can view or modify the test object description of any test object in the repository or to add new objects to the repository. 
Quicktest learns the default property values and determines in which test object class it fits.If it is not enough it adds assistive properties, one by one to the description until it has compiled the unique description.If no assistive properties are available, then it adds a special Ordianl identifier such as objects location onthe page or in the source code.

QuickTest has two types of object repositories for storing object information: shared object repositories and action object repositories. You can choose which type of object repository you want to use as the default type for new tests, and you can change the default as necessary for each new test.

The object repository per-action mode is the default setting. In this mode, QuickTest automatically creates an object repository file for each action in your test so that you can create and run tests without creating, choosing, or modifying object repository files. However, if you do modify values in an action object repository, your changes do not have any effect on other actions. Therefore, if the same test object exists in more than one action and you modify an object's property values in one action, you may need to make the same change in every action (and any test) containing the object.

For any automation tool that follows OO concept the object repository forms the basis of automation frame-work. It is indeed important to make a choice between Shared & script specific (Action specific) object repository. For a web based application, it is not possible to have a shared object repository as too many objects in one .mdb file could lead to commotion especially when we have a team of automation testers. Thus, automation testers should be assigned partition specific responsibility in maintaining the object repository and updating it as when required. Further, QTP 9.0 has a wonderful drag & drop feature in creating object respoitory. Thus both shared as well as action specific can be maintained.

Now comes the golden question - Is it possible to create OR without using RECORD feature of QTP. Well, the answer is YES. Descriptive Programming is the best way of doing it. But for doing so the business documents should have UI mock-ups that have been reviewed and sign-off by the business experts. These mock-ups would then give the tester an idea about the various objects and their respective classes. The automation tester should than create his own repository using the describe method. But this is again time-consuming. Try avoiding descriptive programming to create OR. However, DP is the only the best option when the DEV team are developing the APP using customized objects; as a result of which QTP cannot recognize these objects. HTCs are the best example of customization. The best work-around is treating these customized objects as combination of objects and creating scripts accordingly. This is too much of trial & error method.

Once the OR is ready, then it should be maintained using QC or TD. However, during script execution the run-time is affected, but at the cost of having well-maintained OR.

Adding objects to a local object repository:
An object can be added to the local object repository in one of the following ways:

1. Record some actions on the object; this will automatically add this object to the object repository. If you do not need the recorded statements in your script, you can delete them and it will not remove the added object from the object repository.

2. Add objects manually.

  1. Go to Resources -> Object Repository.

  2. In the Filter combobox, select “Local Objects.”

  3. Go to Object -> Add Objects to Local.

  4. Click on the object to be added to the repository.

  5. If the Object Selection window appears, select the desired object, and click <OK>.

  6. If the Add Object to Object Repository window appears, select the appropriate option:

    To add only the selected object, select the “Only the selected object” radio button. To add the selected object and its child objects of a specified type, select the “Selected object and its descendants of type” radio button. Then, select the checkbox next to the child object types that should be added.

  7. Click <OK>.

3. Manually define a new test object.

  1. Go to Resources -> Object Repository.

  2. In the Filter combobox, select “Local Objects.”

  3. Go to Object -> Define New Test Object.

  4. Select the appropriate Environment for your test object. For example, to add a Link object, select “Web.”

  5. Select the desired test object class for the new object.

  6. Enter a name for your test object.

  7. Fill in the Test object details as needed. The Test object details area automatically contains the mandatory properties defined for the object class in the Object Identification dialog box. You can add or remove properties as required, and define values for the properties.

    To add properties, click the “Add description properties” button (with the + icon). Select the properties to be added and click <OK>.
    To remove properties, select the properties to be removed, and click the “Remove selected description properties” button (with the X icon)

  8. Click <Add> to add the new object.

  9. Repeat steps d through h as needed.

  10. When done, click <Close>.

Note:
When you manually define an object, QuickTest Professional will not automatically add the object’s parent. If the parent objects are not present, you will need to define them as well. Once the objects are added to the repository, you can drag-and-drop them to their appropriate positions.

4. Add the object using the Active Screen.

  1. In the Active Screen, right-click on the object to be added.

  2. Select “View/Add Object.”

  3. If the Object Selection window appears, verify the desired object is selected, and click <OK>.

  4. In the Object Properties window, click <Add to Repository>.

Adding objects to a shared object repository:
An object can be added to a shared object repository in one of the following ways:

1. From a local repository.
2. Add objects manually.

  1. Go to Resources -> Object Repository Manager.

  2. Go to File -> Open -> <repository to open>.

  3. By default the repository will open in read-only mode. Go to File -> Enable Editing.

  4. Go to Object -> Add Objects.

  5. Click on the object to be added to the repository.

  6. If the Object Selection window appears, select the desired object, and click <OK>.

  7. If the Add Object to Object Repository window appears, select the appropriate option:

    To add only the selected object, select the “Only the selected object” radio button. To add the selected object and its child objects of a specified type, select the “Selected object and its descendants of type” radio button. Then, select the checkbox next to the child object types that should be added.

  8. Click <OK>.

3. Manually define a new test object.

  1. Go to Resources -> Object Repository Manager.

  2. Go to File -> Open -> <repository to open>.

  3. By default the repository will open in read-only mode. Go to File -> Enable Editing.

  4. Go to Object -> Define New Test Object.

  5. Select the appropriate Environment for your test object. For example, to add a Link object, select “Web.”

  6. Select the desired test object class for the new object.

  7. Enter a name for your test object.

  8. Fill in the Test object details as needed. The Test object details area automatically contains the mandatory properties defined for the object class in the Object Identification dialog box. You can add or remove properties as required, and define values for the properties.

    To add properties, click the “Add description properties” button (with the + icon). Select the properties to be added and click <OK>.
    To remove properties, select the properties to be removed and click the “Remove selected description properties” button (with the X icon)

  9. Click <Add> to add the new object.

  10. Repeat steps d through h as needed.

  11. When done, click <Close>.

Note:
When you manually define an object, QuickTest Professional will not automatically add the object’s parent. If the parent objects are not present, you will need to define them as well. Once the objects are added to the repository, you can drag and drop them to their appropriate positions.

4. Merge with another shared object repository. 

Merging a local object repository with a shared object repository:
To merge the contents of a local repository into a shared repository, the shared repository must be associated with the action containing the local repository. In the Object Repository Manager, select the “Update from Local Repository” option.

Updating the Shared Object Repository with the objects in the Local Repository will merge all objects from the Local Repository into the Shared Repository. All objects will be removed from the Local Repository.

1. Save the script containing the Local Repository. Open a new test.
2. Go to Resources -> Object Repository Manager.
3. In the Object Repository Manager window, go to File -> Open, and select the Shared Object Repository file. Clear the “Open in read-only mode” checkbox.
4. If the repository file opened in read-only mode, go to File -> Enable Editing.
5. Go to Tools -> Update from Local Repository.
6. Click the “Add Tests” icon button. If you are connected to a TestDirector for Quality Center with Business Process Testing, you will have the option to browse for a test or a component. Select the appropriate choice.
7. Navigate to the test or component containing the Local Repository.

Note:
You can only add a test containing actions that are associated with the Shared Object Repository you are updating and whose Local Object Repositories contain objects.

8. In the Update from Local Repository dialog, select the desired action.
9. Repeat steps 6 through 8 as needed.
10. Click <Update All>.

Note:
If the test using the Shared and Local Repositories is currently open, you may receive an error similar to the following:

“You cannot update this shared object repository from the <path> test’s local object repository because the test is currently locked by ‘<username> on machine ‘<machine name>’. Wait for the test to be unlocked and then try to perform the update operation for this test again.

If so, open a new test in QuickTest Professional to release (unlock) the test and repeat step 10.

11. Perform any steps needed to resolve conflicts.
12. If you are performing multiple merges, go to File -> Save and Merge Next to perform the next merge (the Local Object Repository of the next action being merged into the Shared Object Repository).
13. Click <Yes> to save your changes between merges. If you click <No>, the current merge (objects merged from the last action) will not be saved.
14. Repeat steps 11 through 13 to complete the multiple merges.
15. Choose File -> Exit, then click <Yes> to save the updated Object Repository.  

Merging shared object repositories:
1. Open the Object Repository Manager.
2. Go to Tools -> Object Repository Merge Tool.
3. In the New Merge window, browse to the primary repository file. Mercury recommends selecting the repository file you have invested the most time into as the primary repository file.
4. Select the secondary repository file.
5. Click <OK>.
6. Review the merge statistics, as described in Viewing Merge Statistics, and click <Close>.
7. Resolve any merge conflicts that were reported.

Resolving object conflicts:
Conflicts between objects in the primary and secondary object repositories are resolved automatically by the Object Repository Merge Tool using default resolution settings. For information on defining the default settings, refer to the QuickTest Professional User’s Guide (Help -> QuickTest Professional Help -> QuickTest Professional User’s Guide -> Managing and Merging Object Repositories -> Merging Shared Object Repositories -> Defining Default Settings).

The Object Repository Merge Tool also allows you to change the way the merge was performed for each individual object that causes a conflict.

1. In the object repository tree, select an object that has a conflict (there will be an icon to the left of the object name). The conflicting objects are highlighted in the source repositories. A description of the conflict and the resolution method used by the Object Repository Merge Tool is described in the Resolution Options pane.
2. In the Resolution Options pane, select a radio button to choose a resolution method. The target object repository is updated according to your selection and redisplayed.

Note:
The resolution method the Merge Tool used is selected by default.

3. Click <Previous Conflict> or <Next Conflict> to jump directly to the next or previous conflict in the target object repository hierarchy.
4. Repeat steps 1 through 3, as needed.
5. Save the merged object repository file







Another articles:


Search Articles  


Your place for 1000+ free Software Testing and QA articles, testing tools, discussions, news and the best bunch of testers on the net.
q       What is Software QA Testings?     q       Privacy Policy 
q       Join Software QA Testings Today   q       Contact US
q       Chapters, Sections and Articles