Friday, 25 September 2015

Object Repository

QTP uses a "human brain" like technology for identification of objects. During record time QTP tries to learn all the properties of a GUI object on which operation is performed. During Run-Time, QTP compares the stored object properties with actual properties of the object available on screen and it identifies the object uniquely independent of its location on the screen. The stored object along with its properties is called TEST Object. During Run-Time, the actual object which is available on the application under test is called Run-Time Object. This is known as Quick Tests "Test Object Model". Information about the Test Objects is stored in Object Repository. Add-ins help in  instructing Quick Test in advance of the nature of object to be recorded so it has to reduce the time required to learn its properties. So it used Object repositories. Simply this object repository acts as a brain for QTP.

There are 2 Types of Object Repository in QTP
  • Local Object Repository
  • Shared Object Repository

Local Object Repository
Local Object Repository is the default object repository. It is specifically records according to actions and can be used only for a particular action. Local Object Repository is preferable when application is not dynamic I mean if the actions or methods are not changing for an object with respect to time. Local Object Repository  cannot be reused. You can perform many operations in the local object repository such as we can Highlight an object stored in repository on the application under test. We can check whether a particular object in our AUT is stored in the Object Repository or not. We can  Cut , Copy , Paste  , Modify and Delete Objects in Local repository. In case if we have accidentally modified the value of a property we can update its description from the application using update function.
Shared Object Repository
Global or Shared Object  Repository is preferable when application is dynamic and object description change frequently. Between Shared and local object repository, shared object repository is more commonly used in automation projects. However, it has maintenance and administration as compared to local object repository. 
                           
To create and use a shared object repository you need to perform three broad steps
  • Creating a Shared Object Repository
  • Associating a Shared Object Repository
  • Editing a Shared Object Repository


Step 1) Creating a Shared Object Repository
  • All repositories are local by default.  To create a Shared Object Repository, in the Object Repository Dialog Box, Click File > Export Local Objects
  • Repository files always have an extension called ".tsr". Give a suitable name as  "yash" and save it.
  • The Shared Repository File is created

Step 2)Associating a Shared Object Repository
  • Next step is we have to associate the repository to our test, which enables us to use it
  • To associate repository with a test, Click Resources > Associate Repository
  • We can select the Repository to associate with Actions available in your test.
  • Now we can now use this shared repository to develop our test

Step 3) Editing a Shared Object Repository
  • We can use the Object Repository Manager to Edit a Share Repository.
  • Select Resources > Object Repository Manager .Open the Object Repository which we created as "yash" before.
  • By Default, Repository is opened in Read-only mode. To enable editing click File > Enable Editing
  • Once editing is enabled we can do all the operations like cut, copy, paste, rename objects etc and we can also do in Object Repository
  • Using  Object Repository Manager  is we can compare two Object Repositories. QTP will give us a static's of what's most unique and common in both the repositories
  • We can use the Object repository merge tool to merge two repositories into one

No comments:

Post a Comment