Tuesday, 10 May 2011

Object Repository in QTP

What is Object Repository? What is the usage in Object Repository?

Object Repository: It is a storage place of QTP where we can store the objects information and it also as interface between the test script and the AUT in order to identify the objects during execution.
It is a mechanism to identify the objects with the tool to the application. It is interface between tool and the application. Without identifying object properties in the application we can’t able to test the application.

Object is instance or entity in the application, which has structure and properties.

Software objects:
We call Pop-up Windows, Web Pages, Buttons, Edit boxes, Check boxes,                    Como boxes, List boxes etc. as software objects.
What are the types in Object Repository?
There are 2 types in Object Repository
1.   Local Repository (.MTR extension)
2.   Shared Repository (.TSR extension)

          1. Local Repository: (Resource <menu> à object repository or Ctrl +R)
          QTP creates a Local Repository for every Action automatically during Recording. That cannot be shared among tests.
The following Operations only on Local Object Repository:

                                   1.We can able to add some more object to Local Repository.
                2.We can able to rename the objects in the Local Repository.
                3.We can able to delete the objects in the Local Repository.
Note: above operations as it is QTP internal file user no need to save modifications.

          2. Shared Repository:
User (Test Engineer) creates the Shared Repository by adding objects. That can be shared among number of tests.
Using this method user can perform modifications on objects easily.

     The following Operations only on Shared Object Repository:

                                    1.We can able to add some more object to Shared Repository.
            2.We can able to rename the objects in the Shared Repository.
            3.We can able to delete the objects in the Shared Repository.

Ex1. How to add object properties in Local object repository in the test?


   1. Open Local Repository:
   Resources <menu> à Object Repository

   2. In OR: Objects<menu> à click add objects to the local à with hand icon click on the respective object                 (ie., show the object)
       3.     Click OK

     Ex: click on webpage that object   properties add to the object repository.

Note: No need to save separately, it saves automatically.
Ex1. How to add object properties in Shared object repository in the test?

1.    Resource <menu> à Object  Repository Manager (ORM)

2.    In ORM: Object à add objects à with the hand icon show the window / object (i.e., click on that objects)
         When click on the object / window /   
         webpage the following options will    

 Selected object only:à it stores selected objects only

 Default object types:à it stores all the default objects

All objects types:à it stores all objects including static objects

Selected object types:     à it stores that class objects, we can select more than one class also.

3.    Click OK Button

That selected objects add to the repository.

Ex2. How to add the particular Test object in Local Object Repository or Shared Object Repository?


1. Resources <menu> à Object Repository à Click on the + button
à Select the property to add à Click Ok

Now that property will appear in the Test object details.

If add in Shared object Repository Open .tsr file and do the above steps.

Ex 3. Defining new test objects in Object Repository (OR) or Object Repository Manager (ORM)?
1. Open OR or ORM

2. Object <menu> à Define New Object
          In the Select Environment
          Select Class of the object
          Enter name of the object à Click add button à Click Close

3. Select object à select property name à enter value à save
Like this select one by one property and enter values.

Ex4. How to save Local object Repository?
After generate the recording script (File à Save) Simply save the test.
Whenever save test file local repository automatically save with that test.

Ex5. How to Modify Local Object Repository as Shared Object Repository?  
Steps: In OR: File à Export Local Objects à Give the filename à click Ok
Imp Note: Whenever save the file with extension .tsr that file we have to use as local repository or shared repository
Understand & avoid the confusion:
If we use that .tsr file in that test only – It’s used as local repository.
If we use that .tsr file in another test - It is used as Shared repository.

Ex6. How to Save and Replace the Local objects?
Steps: In OR: File à Export and Replace Local Object à Select the old OR à Click Ok

Ex7.  How to Renaming objects in Local Object Repository or Shared Object Repository?

        Rename object in Local OR
      Rename object in Shared OR
Steps: In OR: Select object and right click on that object à choose rename à modify the name à release the mouse.
Steps: In Object Repository Manager:
1. Resources <menu> à ORM:
2. File à Open: Browse path of the repository fie.

3. File à enable editing à select object & right click à choose Rename à modify the name after release mouse.
4. File à Save
5. File à Exit form ORM

Ex8. How to Deleting objects in Local Object Repository and Shared Object Repository?
Deleting objects in Local OR
Deleting Objects in Shared OR
Resource <menu> à Object Repository à select object and right click on that
à choose delete option
à confirm deletion
à File à Close to close repository
Steps: In Object Repository Manager:
1. Resource <menu> à ORM :
2. File à Open : Browse the path of the repository file
3. File à enable editing à select object  & right click  à choose delete option à confirm the deletion
4. File à Save
5. File à Exist from ORM

How to Associating Repositories to the Test

I Method: How to associate the Repository to the test using the Tool Option?

1. Open the Test
2. In the Select - Resources <menu>à Associate Repositories à Click + Button to browse the test Repository à Select the Available action(s) à Click the > or >> button to associate the repository à Click Ok     
Note: suppose 4 actions are there in that associate only 1 & 3 actions that only select and click >> button.        

II Method: How to associate the Repositories to the test using descriptive programming?

1. Open the Test.
2. Write the following Code where u wants to add or find or remove
Add Objects to the Repository:
RepositoriesCollection.Add “c:\Login.tsr”

Remove All Repositories at end of the script:

Find the Object Repository:
RepPath = "C:\login.tsr"
Pos = RepositoriesCollection.Find(RepPath)

Delete Objects Repository:
RepPath = "C:\login.tsr"
Pos = RepositoriesCollection.Find(RepPath)

What is the difference between the Local Object Repository and (Shared) Associate Object Repository?

Shared (Associate) Object Repository
Local Object Repository
It is not editable.
Open object repository manager enables you to open multiple shared object repositories and modify them as needed.
(From file system and from Quality Center project).
We can add the .tsr files.
It is editable.

Descriptive Programming versus Object Repository in QTP:


If we use the Descriptive Programming for identifying the objects no need to use the Object Repository concept in Tool Options.


Using Descriptive Programming:


Browser("name:=Yahoo! India").Page("title:=Yahoo! India").Link("text:=Mail").Click


Note:  Here no need to associate object repository to the test for identify the object properties if we use descriptive programming.


Using Object Repository: While recording generate script:


Browser("Yahoo! India").Page("Yahoo! India").Link("Mail").Click


Here the above object properties are stored in Object Repository.

Those are Browser Name, Page title and link text names.

Ex1. Flight Application take the OR for login & password add using descriptive programming without using the tool options.

Repositoriescollection.Add "c:\Login.tsr"
SystemUtil.Run "C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe","","C:\Program Files\HP\QuickTest Professional\samples\flight\app\","open"
Dialog("Login").WinEdit("Agent Name:").Set "test"
Dialog("Login").WinEdit("Password:").Set "mercury"
Window("Flight Reservation").Close


Use Local or Shared Object Repositories in QTP?               How to Decide? Where Use these?

To choose where to save objects, you need to understand the differences between local and shared object repositories.

Local Repository: It 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.

Shared Object Repository: It is generally the preferred option when
·   You are creating tests using keyword-driven methodologies (not using record).
·  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.



  1. qtp object repositroy with tool options..

    Hadoop training in hyderabad.All the basic and get the full knowledge of hadoop.
    hadoop training in hyderabad

  2. qto object repository with tool options nic eposts..

    informatica online training

  3. Thanks for Sharing the valuable information and thanks for sharing the wonderful article..We are glad to see such a wonderful article..
    QTP Training in Chennai | QTP Training Institute in Chennai | QTP Training

  4. Pretty article! I found some useful information in your blog, it was awesome to read, thanks for sharing this great content to my vision, keep sharing.

    PHP Training in Chennai | Webdesigning Training in Chennai


  5. Thanks for splitting your comprehension with us. It’s really useful to me & I hope it helps the people who in need of this vital information.
    Performance Tuning Training in Chennai | Oracle PL/SQL Training in Chennai

  6. Well Said, you have furnished the right information that will be useful to anyone at all time. Thanks for sharing your Ideas.
    PHP Training in Chennai | PHP course in Chennai

  7. Here i had read the content you had posted. It will be enabled for those who are just beginning to SEO. It is much interesting so please keep update like this.

    Home Spa Services in Mumbai

  8. Great efforts put it to find the article about QTP, Definitely will share the same to other forums.
    We are also one of the best sources to learn Selnium -Selenium training in Chennai |Best Selenium training institute in Chennai

  9. Nice information about QTP object Repository My sincere thanks for sharing this post Please Continue to share this post
    Software Testing Training in Chennai

  10. I wondered upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I’ll be subscribing to your feed and I hope you post again soon.

    Selenium Training in Bangalore

  11. Once you have found such a forum, all that required is to register and get yourself approved by a moderator.javascript forum

  12. I wondered upon your blog and wanted to say that I have really enjoyed reading your blog posts.

    automation testing courses online


TrainingHUB. Powered by Blogger.

Total Pageviews


QTP Training in hyderabad

Sql Tutorial

Popular Posts

Our Facebook Page