Friday, May 6, 2011

Object Repository


Object Repository:
Object repository is a storage place where one can store the objects information and it also acts as interface between the test script and the AUT(application under test) in order to identify the original objects during execution.
Types of Object Repository:
 There are two types of object repository they are.
Per-Action Repository:
 If at all this type is selected as an object repository then the QTP will be automatically creating and managing an individual repository for every action.
Shared Repository:
  Shared repository has to be created and managed manually once a shared repository to created it can be shared among number of tests.It is reusable and easy to maintain.
1) Collect the objects information in to the object repository
2) Click on export
3) Browse the desired location
4) Specify the file name with .TSR extension
5) Click on save button



Or we can create it through Object Repository Manager  Option available in later version of QTP 9.0

Object Identification in QTP

Object identification:
Object identification is based on four types of properties and an ordinal identifier
 1. Mandatory Properties
 2. Assistive properties
 3. Base-Filter Properties
4. Optional Filter properties

QTP learns the information in the following in case only normal brain:
First of all the QTP will learn all the mandatory properties at a time and then think whether these properties are sufficient to identify the object uniquely. If it feels sufficient then it will stop learning otherwise it will learn the first assistive property and once again stops and thinks whether these properties are sufficient to identify the object uniquely. If it feels sufficient then it stops learning otherwise learns the second assistive property and checks whether these properties are sufficient or not. This process continuous till the QTP satisfies or up to the end of the assistive properties list. At the end of the assistive properties list also if it feels not satisfied then it will finally learn the ordinal identifier and stops learning.

QTP learns the information in the following way in case of smart brain also (smart identification):
  While learning the mandatory properties along with them it will learn the base filter properties, optional filter properties and stores them in the secret place.
It considers the mandatory properties only and check whether these properties are sufficient to identify the object uniquely and repeats the above process.

Note: In the above learning process except base filter properties and optional filter properties all the remaining information learnt will be stored in the object repository.

Whenever the QTP is unable to identify the objects with the help of the properties present in the object repository then the special mechanism provided by QTP to identify the object smartly with some other properties is known as smart identification.

QTP will use the information in the following way to identify the object during execution:
                   First of all QTP will use all the properties present in the object repository except ordinal identifier and try to identify the object. If at all the object is not identified then it will forget about all these properties and freshly enters in to the secret place.
                   QTP will consider all the base filter properties and try to identify the object and forms a list of all the objects that are matched with the base filter properties.
If the list contains only one object then that is the object otherwise it will take the support of first optional filter property and try to match with all the object present in the list and forms a new list of all the objects that are matched with that property and then check whether the list is containing one object or more that one object. If the list is containing more than one object then it will consider the second optional filter property and repeats the whole procedure till the list contains on object or up to the end of the optional properties list.
At the end of the optional filter properties list also if the list is containing more than one object then it will finally go to the object repository and check whether the ordinal identifier is available or not. If at all the ordinal identifier is available it will identify the object roughly using that otherwise HANDSUP.

Ordinal Identifiers:
 There are three types of ordinal identifiers
  1.Location
  2.Index
  3.Creation time



1.Location:
                If at all the location is selected, as an ordinal identifier then the QTP will generate a sequence of numbers from 0,1,2,3 based on the sequence of the objects located in AUT.

2.Index:
                   If at all the index is selected as an ordinal identifier than the QTP will generate the numbers from 0,1,2,3…. Based on the sequence of the programs of the objects.

3.Creation Time (specially for web pages):
                   If at all creation time is selected as an ordinal identifier the QTP will generate the number from 0,1,2,3,… based on the loading time of the web pages