Sei sulla pagina 1di 11

http://www.onsoftwaretest.

com/
http://www.onsoftwaretest.com/modules.php?name=News&f
ile=article&sid=24

How to delete objects from the object repository?


Removing objects from a local object repository:
1. Go to Resources -> Object Repository.
2. In the Filter combobox, select “Local Objects.”
3. In the object tree, select the object to be removed.
4. Click the delete toolbar button.
5. Click <Yes> to confirm the deletion.
6. Save the test to save the updated local repository.
The object, and any children it may have, will be removed.
Removing objects from a shared object repository:
1. Go to Resources -> Object Repository Manager.
2. Go to File -> Open. Navigate to the desired Shared Object Repository file.
3. By default, the repository will open in read-only mode. Go to File -> Enable Editing.
4. In the object tree, select the object to be removed.
5. Click the delete toolbar button.
6. Click <Yes> to confirm the deletion.
7. Save the updated shared repository.
The object, and any children it may have, will be removed.
How to add objects to the object repository (QTP 9.0)?
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.
1. I have a problem related to object identification. Please take a look at this, and let me
know if you can help with this:
Hi Ankur/fellow testers,
I am currently trying to run QTP scripts which were recorded on a PC- PC1, on one of
my PCs- PC2 and the script continually fails at points where it does not find objects in
the repository. I am forced to re-record time and again to solve this problem.
Right now, I am doing this step where I’m logged into Outlook and am trying to select
File –> Open.
I get the following error for the Context Menu object

The “ContextMenu” object was not found in the Object Repository.
Check the Object Repository to confirm that the object exists or to find the correct name
for the object.
Line (36): “Window(”Outlook Express”).WinObject(”Outlook Express
Message_2″).WinMenu(”ContextMenu”).Select “Open Ctrl+O”".

How do we avoid this problem while porting between PCs? One of the approaches I tried
was to export the objects in PC1 and save it as a .tsr file which i copied into the other pc,
PC2. In PC2, I tried to import this tsr file by pasting the following bit of code in my qtp
script:
Dim App ‘As Application
Set App = CreateObject(”QuickTest.Application”)
App.Test.Settings.Resources.ObjectRepositoryPath =”c:\act.tsr”
However, this failed with the error:
You cannot change the object repository type for this test.
Line (3): “App.Test.Settings.Resources.ObjectRepositoryPath =”c:\act.tsr”".
Any idea? We are wasting a lot of time having to re-record/add objects which are not
recognized.
Appreciate any help.
How to merge object repository files (QTP 9.0)?
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
What is the QuickTest Automation Object Model and how is
it used?
You can use the QuickTest Professional Automation Object Model to write programs that
automate your QuickTest operations. The QuickTest Automation Object Model provides objects,
methods, and properties that enable you to control QuickTest from another application.The new
QuickTest Professional Automation Object Model enables you to automate test management.
You can now control virtually every QuickTest feature and capability using the objects, methods
and properties included in the QuickTest Professional Automation Object Model. Automation
scripts make it easy to perform any QuickTest operation multiple times in multiple tests without
having to open the QuickTest application, for example,
• You can write a script that modifies the test object description properties in the Object
Identification dialog box and performs an update run on all tests in a specified file folder.
• After installing a new add-in, an automation script can associate this add-in to all relevant
tests.
• You can write an automation script to run a selected batch of tests. For each test, you can
retrieve the associated add-ins list. Then, if the necessary add-ins are not already loaded,
you can close QuickTest, load the necessary add-ins, reopen QuickTest, and run the test.
• You can define your settings for a test in QuickTest, then click “Generate Script” in the
Generate tab of the Test Settings dialog box to generate an automation script based on the
current test settings. You can then apply those same settings automatically to multiple
tests using the whole automation script or excerpts from the generated file.
Example:
You can create and run an automation program from Microsoft Visual Basic that loads the
required add-ins for a test, starts QuickTest in visible or minimized mode, opens the test,
configures settings that correspond to those in the Options, Test Settings, and Record and Run
Settings dialog boxes, runs the test, and saves the test.
Creating automation programs:
The Properties tab of the Test Settings dialog box, the General tab of the Options dialog box, and
the Object Identification dialog box each contain a “Generate Script” button. Clicking this button
generates a automation script file (.vbs) containing the current settings from the corresponding
dialog box.
You can run the generated script as is to open QuickTest with the exact configuration of the
QuickTest application that generated the script, or you can copy and paste selected lines from the
generated files into your own automation script.
Generating an automation script for QuickTest Professional options:
1. Go to Tools -> Options.
2. Select the General tab.
3. Click <Generate Script>.
4. Save the script to the desired location.
5. Click <OK> to close the Options dialog.
Generating an automation script for test settings:
1. Go to Test -> Settings.
2. Select the Properties tab.
3. Click <Generate Script>.
4. Save the script to the desired location.
5. Click <OK> to close the Test Settings dialog.
Generating an automation script for object identification settings:
1. Go to Tools -> Object Identification.
2. Click <Generate Script>.
3. Save the script to the desired location.
4. Click <OK> to close the Object Identification dialog.
The QuickTest Automation Object Model Reference file is a help file that provides detailed
descriptions, syntax information, and examples for the objects, methods, and properties in the
QuickTest Automation Object Model.
Use an Automation Object Model to load the Shared
Object Repository?
QuickTest Professional 9.0
QuickTest Professional 9.0 does not support dynamically loading object repositories at runtime.
AOM statements are not designed to be executed from within a test script.
QuickTest Professional 9.0 does allow you to associate and load (not at runtime) multiple Object
Repository files.
QuickTest Professional 8.2 and below
Use the Automation Object Model to specify the path to a Shared Object Repository:
Dim App ‘As Application
Set App = CreateObject(”QuickTest.Application”)
App.Test.Settings.Resources.ObjectRepositoryPath =
“<PathToYourSharedRepositoryTsrFileHere>”
Note:
Be sure to replace <PathToYourSharedRepositoryTsrFileHere> with the path to the repository
you want to use.
Now the test will load and use the specified Shared Object Repository.
Note:
You may be able to execute the AOM statements from within a script, however they are not
intended to be used this way. Whenever possible, check your conditions and modify the settings
in an external .vbs file before the test execution begins.

Possibly related posts: (automatically generated)


• How to associate Shared Object Repositories to the test (QTP 9.0)?
• Some Useful Tips with QTP
• Oracle BI EE 10.1.3.3/2 - Import from Repository - Deprecated 2-Way Merge
• Difference between QTP 8.2 & QTP 9.0 ??

Use an Automation Object Model to load the Shared


Object Repository?
QuickTest Professional 9.0
QuickTest Professional 9.0 does not support dynamically loading object repositories at runtime.
AOM statements are not designed to be executed from within a test script.
QuickTest Professional 9.0 does allow you to associate and load (not at runtime) multiple Object
Repository files.
QuickTest Professional 8.2 and below
Use the Automation Object Model to specify the path to a Shared Object Repository:
Dim App ‘As Application
Set App = CreateObject(”QuickTest.Application”)
App.Test.Settings.Resources.ObjectRepositoryPath =
“<PathToYourSharedRepositoryTsrFileHere>”
Note:
Be sure to replace <PathToYourSharedRepositoryTsrFileHere> with the path to the repository
you want to use.
Now the test will load and use the specified Shared Object Repository.
Note:
You may be able to execute the AOM statements from within a script, however they are not
intended to be used this way. Whenever possible, check your conditions and modify the settings
in an external .vbs file before the test execution begins.

Possibly related posts: (automatically generated)


• How to associate Shared Object Repositories to the test (QTP 9.0)?
• Some Useful Tips with QTP
• Oracle BI EE 10.1.3.3/2 - Import from Repository - Deprecated 2-Way Merge
• Difference between QTP 8.2 & QTP 9.0 ??

What are the new features of the QTP 9.0


Object Repository?
Features and functionality of the QTP 9.0 Object Repository With the QTP 9.0 Object
Repository, you can:
1. Associate multiple repositories with an action.
2. Use both a Local and Shared Object Repositories with an action.
Note:
If both the Local and Shared Object Repository files contain the same object, QuickTest
Professional will use the object in the Local Repository.
3. Add objects from the Local Repository to an associated Shared Repository.
4. Manually create objects in the repository.
5. Specify different Shared Object Repository files with each action in a test.
6. Merge Object Repository files.
7. Import/export the Object Repository file into an XML file.
8. Move objects from one parent to another.
For more information on the Object Repository, refer to the QuickTest Professional User’s Guide
(Help -> QuickTest Professional Help -> QuickTest User’s Guide -> Managing and Merging
Object Repositories.
Difficulties in identifying dynamic objects
Sometimes, the user has an object with a dynamic description (e.g., the name property is
completely dynamic). Regular Expressions will not help in this case, since the whole name is
changed between runs.
Uniquely identifying dynamic objects
When QuickTest Professional has difficulties identifying objects uniquely, you may need to
change the properties used in the description of the object.
There are two ways to do this:
1. Configure the properties that are used to identify the object class.Note:
These changes will affect all objects of this class type.For QuickTest Professional 6.0
and above
QuickTest Professional 6.0 added the Object Identification tool to allow you to configure
the properties which are learned for object classes.
1. Go to Tools -> Object Identification.
2. Select the environment type (e.g., ActiveX or Java) for the problem object from
the Environment combobox.
3. Select the object class in the Test Object classes list. The lists on the right side of
the dialog will be populated with the current mandatory and assistive properties.
4. Click <Add/Remove> under the desired list.
5. Clear the checkbox next to the dynamic properties.
6. Select the checkbox next to the new properties you wish to use.
7. Click <OK>.
8. Click <OK> to close the Object Identification dialog.
9. Relearn the objects into the Object Repository.
For detailed step by step instructions, please refer to the “Configuring Mandatory and
Assistive Recording Properties” chapter in the User’s guide.
For Astra QuickTest/QuickTest Professional 5.6 or below
10. Open the registry editor (Start -> Run -> regedit.)
11. Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Mercury
Interactive\QuickTest Professional\MicTest\Test Objects\<object>\Description
where <object> is the class type of the problem object. Expand the Astra
QuickTest folder if you are using Astra QuickTest. You will see a list of properties
that are used to identify these objects.
12. Remove the dynamic property by right-clicking on the value and selecting
Modify. Set the value data to zero. Repeat as needed.
13. Add a new property to identify the object. Go to Edit -> New -> DWORD Value.
Enter the name of the property to be used. Right-click and select “Modify.” Set
the value data to 58 Hexadecimal to make the property mandatory or 448
Hexadecimal to make the property additional (used if there are not enough
mandatory properties to uniquely identify the object). Repeat as needed.
14. Close the registry.
15. Restart Astra QuickTest/QuickTest Professional.
16. Relearn the object into the Object Repository.
You can find a list of available properties in the registry at
HKEY_CURRENT_USER\Software\Mercury Interactive\Astra
QuickTest\MicTest\Attributes (or QuickTest Professional if you are using QuickTest
Professional).
Note:
The exact paths within the registry may differ slightly with different versions of the
applications. Also, all the properties listed under the registry key may not be available for
all objects.
2. Instruct QuickTest Professional to use different properties only for the problem
object.Note:
These changes will affect only the objects you modify but will not affect other objects of
the same class type.QuickTest Professional 9.0
For information on modifying object property or property values in QuickTest
Professional 9.0, QuickTest Professional 8.2 and below
1. Right-click on the object in the Keyword View (Tree View, in QuickTest
Professional 6.5 and below).
2. Select Object Properties.
3. Click <Add/Remove> and clear the checkbox for the dynamic property.
4. Click <OK> to close the Add/Remove Properties and Object Properties dialogs.
5. Go to Tools -> Object Repository.
6. Select the problem object in the object repository tree.
7. Click <Add/Remove>.
8. Set the checkbox next to the properties you wish to use to uniquely identify the
object.

Possibly related posts: (automatically generated)


• What are the new features of the QTP 9.0 Object Repository?
• What is Smart Identification?
• What is the significance of i_vstamp and i_is_replica
• Some Useful Tips with QTP

Potrebbero piacerti anche