Understanding QTP Object Repository and Object Repository Manager
This instructional guide will concentrate on QTP’s Object Repository. In our earlier tutorials, we addressed the way QTP recognizes and saves objects into a storage zone known as the OR. We additionally examined how the properties of the objects are displayed within the OR.
Recommended IPTV Service Providers
- IPTVGREAT – Rating 4.8/5 ( 600+ Reviews )
- IPTVRESALE – Rating 5/5 ( 200+ Reviews )
- IPTVGANG – Rating 4.7/5 ( 1200+ Reviews )
- IPTVUNLOCK – Rating 5/5 ( 65 Reviews )
- IPTVFOLLOW -Rating 5/5 ( 48 Reviews )
- IPTVTOPS – Rating 5/5 ( 43 Reviews )
Understanding the QTP Object Repository
The following object repository dialog box will be launched:
Important points to bear in mind are:
- The objects are arranged hierarchically.
- This is a local repository containing objects for Action1.
- If the action features any checkpoints, those will be available in this dialog for modification.
We also mentioned Shared ORs in our former tutorials. Now, let’s delve into them.
A Shared Object Repository holds objects in a file that can be accessed across multiple tests (in read-only mode).
When devising your tests or choosing a framework for your project, you’ll need to decide on the most practical ways and places to store your objects and make them accessible for the tester.
Types of Object Repositories in QTP
These are some of the Object Repository types available in QTP:
- Local ORs – Each action’s objects will be saved in its local repository.
- Shared ORs – All actions will reference a single, read-only OR.
- Local and Shared ORs – An action could utilize both the local and various shared ORs.
In a previous tutorial, we touched on what happens when an action employs both a Shared OR and Local OR, as well as multiple shared ORs.
We will now discuss how a shared OR is created, how to move objects to and from a shared OR to local, and vice versa.
To manage the ORs within your test, QTP offers a dedicated Object Repository Manager (ORM), which can be accessed via the menu item “Resources -> Object Repository Manager“.
ORM can be used to:
- Create New Object Repositories in QTP
- Open Object Repositories
- Save Object Repositories
- Close Object Repositories
- Manage Objects in Shared QTP Object Repositories
- Manage Repository Parameters
- Edit Object Details
- Locate Test Objects
- Perform Merge Operations
- Carry out Import and Export Operations
In this instance, we will demonstrate how to create a test’s shared OR, comprehend how it can be associated, and observe how the objects can be utilized.
To create a shared OR (.tsr) file, launch the ORM. A new repository should automatically open, or you can explicitly open it using the “File -> New” option. The effectiveness of any OR depends on the objects it contains. So, the next step is to add objects.
Here are three ways to do this:
Method #1: Define Test objects. Choose “Object -> Define Test Object,” and the following dialog box will appear:
This is where you specify the environment, class, name, properties, and add the object into the repository. The screenshot shows some sample data that can be inputted.
Method #2: Add Objects: Choose this option to activate the pointy hand. QTP will minimize, and when you select the object you want to add, the following dialog box will appear, letting you add the object.
Method #3: Navigate and Learn: This method is frequently used and the most interesting. As the name implies, instruct QTP to ‘navigate and learn’, point to an object in your application, and QTP will automatically collect the objects in line with your filter settings.
Select this option from the menu or press F6. From the screenshot, you’ll notice a “navigate and learn” dialog at the top of the page. Select the Learn button in the dialog and click on the page. Navigate to as many pages as necessary and click Learn as many times as required. Once done, close the “Navigate and Learn” dialog.
These are the available filter options:
I selected “All Object Types” from the dialog and clicked on the main gmail.com page. The following objects were added to the OR:
Using any of the methods mentioned above, create a shared ORM, add objects, and then save it.
There is another method to add objects to a shared OR, from the local OR.
Either open your test or create a new test, for instance, “Gmail Login.” Launch the OR for this test.
It should appear as follows:
I wish to create a shared OR that holds the email, password, and sign-in objects. The “File” menu offers 2 options: “Export Local Objects” and “Export and Replace Local Objects“. You can use either of these options.
If you select “Export Local Objects“, the local objects will be exported to the designated shared object repository (a file with a .tsr extension). Your test will continue to utilize the objects in the local object repository, and the new shared object repository will not be associated with your test.
With “Export and Replace Local Objects“, the new shared object repository (a file with a .tsr extension) will be associated with your test, and the objects in the local object repository will be removed.
Select any of these options and specify the shared OR to export to.
How to Associate Your Test with a Shared Object Repository
After you have decided to utilize a shared OR for your test, created one and added objects to it, the tester has to deliberately include the .tsr file to enable the test to use the objects in it.
To do this, navigate to “Resources -> Associate Repositories“.
The following dialog box will appear:
Click on the “+” and select the OR. All available actions in your test will be displayed under “Available Actions“.
Choose as many or as few actions as needed. In my case, I only have one, so I’ll select it. Click OK when finished.
After a successful association, the shared OR will appear in the Resources pane, provided it is already visible. If not, you can launch it from the “View -> Resources” option.
If you wish to remove the association, you can right-click on the .tsr in the resources pane and select the “Remove Repository from List” option. Alternatively, you can go to the “Resources -> Associated Repositories” menu option, select the shared ORM to remove, and click on the cross sign.
To understand how a shared OR and Local OR will function together, please refer to our tutorial #8. Though ORMs and ORs have plenty of other features, we have touched upon the most beneficial ones in this article. The remainder of the features can be easily understood by testers once they have reviewed this article.
Hopefully, we have clarified the process of utilizing the QTP Object Repository.
Don’t hesitate to ask your questions if you have any.