Thursday, 20 November 2014

Object Repository

Let assume I have parked my car in the parking lot and want you to bring my car to the gate. What questions you will ask to me to identify the car?
Make, Model, Color… obviously no need. If you ask just for registration number it is more enough to identify my car. So registration number is one unique property to identify the object car. When I tell you the registration number what is happening?
1. You are storing the registration number in your memory.
2. You are comparing the registration number with all the car available in the parking lot.
3. To whichever car the registration number matches, you are going to bring that car to the gate.
Now do the same with QTP. Consider you want to type some value in a UserName WebEdit. So you will save the object UserName WebEdit to the Object Repository which is the utility available in QTP to store object and its properties. When you run the test, QTP will compare the properties and values stored in the Object Repository with the properties in the application under test and perform the operation.

How to add Object to the Object Repository

• Open IE and navigate to google.com
• Open Object Repository Resources -> Object Repository or (Ctrl+R) and navigate to Objects -> Add Object to Local.
• Place the cursor over the Google Search WebEdit. You can notice the hierarchy as Browser -> Page -> WebEdit. Select WebEdit and click on OK.
• Google Search WebEdit will now get added to Object Repository.
Object Repository
Once the object is added to the OR, you can see the Name, Class and Repository in the right hand side under Object Repositories. This Name is called Logical Name which we will use it in our QTP Script. Class will tell you to which class type the Object belongs to and Repository will tell you the type of OR.
There are two types of Object Repository in QTP called Local and Shared. The one we added now is called Local Object Repository, don’t worry about Shared Object Repository will come for this later.

1 comment:

QTP/UFT Tutorials © 2014. All Rights Reserved | Powered by-Blogger | Designed by-Dapinder