Saturday, 27 August 2011

Object Repositories in QTP

Object Repositories in QTP are used to store the elements in the application under test(AUT) in the form of objects to uniquely identify an object at run time.We can use the object repository manager to view and modify the various properties of the object.
Objects can be added into object repository in any one of the following methods.

1. By recording the user interactions with the application under test.
2. By manually adding one or more objects.

Objects can be manually added by clicking the Add Objects button and then clicking on the object that needs to be added.

In some scenarios the objects will be appeared on the screen after a mouse click.To achieve this,hold the CTRL key prior to the mouse click. This will disable the object selection mode and allows us to perform the mouse click operation. Then release the CTRL key and add the object to the repository.

In some scenarios we may need to switch between the applications. We can achieve this by holding CTRL+ALT to disable the object selection mode. Then use ALT + TAB to switching between the applications. Once done, press the CTRL + ALT ky to enable the object selection mode and add the object.

Once the object is added the added object will be displayed in object selection window.The object selection window displays the hierarchy of all objects in the selected page. Select the required object and click on OK button to add the desired element.

The object selection window has the following options.
01. Only selected object
02. Selected object and its direct children
03. Selected object and all its descendants

If option 03 is selected, it'll add all the objects present on the same page.

We have two type of objects in QTP. Test Objects(TO) and Run Time Objects(RO).

Test objects are QTP defined classes which are used to represent the various objects in the application under test.

Run time objects are the actual objects in application under test on which the actions are performed.

Test Object Properties are those that QTP maintains in object repository for identifying a run time object during test execution. QTP allows the enumeration of all TO properties using GetTOProperties method. GetTOProperty and SetTOProperty methods are used to get and modify the test  object property values respectively.


Post a Comment

Back To Top