Header Ads

All about Object Repository And Operation In QTP

image credit:www.ise.ncsu.edu
Object Repository:
It is a storage place of QTP where we can store the objects information those are required for testing and it also acts as interface between the test script and the AUT in order to identify the objects during execution.

In a simple term an object is a graphic user element in an application and object repository is a graphical representation of the objects.
Object:
Object is something, which has structure and properties.Mostly this concept is based on OOPs hierarchy of Objects.. It consists of data that describes the object [properties] and Functions that can be performed on that object[methods]
In OOPs an object is an instance of a class and in QTP, the objects are defined by class.
Like a go button in web context is an instance of webbutton.

It is collection of objects stored in XML file . Objects will have its own properties by which QTP will identify the objects uniquely. During recording this entry to this file is automatically done by QTP.

The entry will have a logical name about the object and physical description about the object in the right side pane.
We can perform several operations:
1. Rename the logical name.
2. Moving objects from one hierarchy to others
3. Change the object description
4. Delete object
5.Highlight selected object 
6. Locating an object
7. Update physical description
8. Filtering object etc.

          
Software objects:
We call windows, WebPages, buttons, edit boxes, check boxes etc.. as software objects.
Types of Object in QTP:
There are four types of object available in QTP.
1. Run time objects
2. Test objects
3. Utility objects
4. Automation objects/User defined objects.
Run time objects: The objects present in the AUT. Ex: Buttons, links, etc…
Test Objects: References of Run time objects. Ex: WinEdit, WinButton, WebButton, Link, etc…
Note:
Test objects names vary from one environment to another.
Ex:
Run time objects Test objects in windows EnvironmentTest objects in VB
Environment
Test objects in web Environment
buttons WinButton VBButton WebButton 
Edit box WinEdit VBEdit WebEdit 
Check box Wincheckbox Vbcheckbox Webcheckbox 


Utility objects

They are QTP reserved objects used for testing and result reporting.
Ex:
1. SystemUtil for launching/closing the application.
2. Reporter for defining results.
3. Services for inserting transaction points
4. Environment for using environment variables
Automation objects/User defined objects
User can create objects; those can be used for performing specific operations. Ex: Creating objects in file system object class, adodb.connection class, dictionary object class, excel. Application class etc.
There are two types of repository available in QTP.
  1. Local repository (.MTR extension-Module Test Repository )
  2. Shared repository(.TSR extension- Test Shared Repository)
Local Repository:

  • QTP creates a Local Repository for every action automatically during Recording. That cannot be shared among tests. 
  • User can add some more objects to Local repository
  • User can perform rename, delete operations in local repository. As it is QTP internal file user no need to save modifications.
How to navigate:
Resource menu-->object repository-->Objects-->Add objects to Local-->show the object-->Click ok
By default QTP saves its objects.

How to rename the object in local object repository:
We can rename the object in object repository. Navigation >>resources-->Object repository-->select the object which you want to rename-->right click on that object-->rename-->type the correct name-->select some other object--> It will automatically rename the previous object

How to delete objects from Object repository:
We can delete the object in object repository. Navigation >>resources-->Object repository-->select the object which you want to delete -->right click on that object-->select delete--click on confirm delete-->close repository.

How to add Objects repositories to an action:
if we miss to add object during recording time but we need that 

 
Shared Repository:

User (Test Engineer) creates shared repository by adding objects. That can be shared among number of tests. Using this method user can perform modifications on objects easily Navigation: Resource menu-->object repository manager (Short cut key Ctrl+R)-->Object-->Add Objects-->show the window/objects-->Click ok

  •          Selected object only--It stores only one object
  •          Default object types--It stores all default objects
  •          All objects types--All default objects with static objects
  •          Selected object types--It stores objects along with Object class. in this case we can add more class.


How to rename the object in shared object repository:

go to resource-->Object repository manager-->file-->open-->click on the browse button to browse path of the repository file-->select file-->enable editing-->select object-->right click -->choose rename-->change the name-->click on the other object-->the last object name automatically changed-->save the file-->close repository manager

How to delete the object in shared object repository:
go to resource-->Object repository manager-->file-->open-->click on the browse button to browse path of the repository file-->select file-->enable editing-->select object-->right click -->choose delete -->confirm deletion-->save the file-->close repository manager
Powered by Blogger.