Sie sind auf Seite 1von 5

Object Repository

Object Repository:
It is a storage place of QTP where objects information can be stored and it also acts
as interface between the Test script and the AUT (Application Under Test) in order to
identify the objects during execution.
Note:
Object : Object is something, which has structure and properties.
Software objects:
We call Windows, Web Pages, 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.
1. Run time objects: The objects present in the AUT. Ex: Buttons, Links, etc
2. Test Objects: References of Run time objects. Ex: WinEdit, WinButton,
WebButton, Link, etc
Note: Test objects names vary from one environment to another.
3. Utility objects: These 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
4. Automation objects/User defined objects
User can create objects; these objects can be used for performing specific
operations.

Ex: 1) Creating objects in filesystemobject class, 2) adodb.connection class,


3) Dictionary object class and 4) Excel. Application class etc.
************************************************************
There are two types of repository available in QTP.
1. Local Repository (.MTR extension)
2. Shared Repository (.TSR extension)
1. Local Repository:
1. QTP creates a Local Repository for every Action automatically during
Recording. This repository cannot be shared among tests.
2. User can add some more objects to Local repository
3. User can perform Rename, Delete operations on local repository. As it is
QTP internal file user no need to save modifications.
2. Shared Repository:
1. User (Test Engineer) creates the Shared Repository by adding objects. The
Repository can be shared among number of tests.
2. Using this method user can perform modifications on objects easily.
************************************************************

Operations on Object Repository


1. Adding objects
Local Repository:
Navigation: open Local Repository (Resource Menu > Object Repository)
Objects>Add objects to Local> Show the Object>Click Ok
(No need to save separately, it saves automatically)
Shared Repository:
Navigation:

Resource

menu>Object

Repository

objects > show the window/object>click ok

Manager>Object>Add

Selected object only

Default object types

All objects types

Selected object types

Note: If we select first option it stores selected objects only, if we select


second option it stores all default objects, if we select third option it stores
All objects including static objects, if we select fourth option, we have to
select object classes then it stores that class objects, we can select more
than one class also.
2. Renaming Objects
1. Local Repository:
Resources > object repository >select object and right click >choose
rename option >modify the name>release the mouse.>close repository
2. Shared Repository:
Resources >object repository manager>file>open>browse path of the
repository file >file>enable editing>select object &Right click>choose
rename option>modify the name > release mouse>save the file & close
repository manager.
3. Deleting Objects
1. Local Repository:
Resources > object repository >select object and right click >choose
delete option >confirm deletion>. >close repository
2. Shared Repository:
Resources

>object

repository

manager>file>open>browse

path

of

the

repository file >file>enable editing>select object &Right click>choose delete


option>confirm the deletion >save the file & close repository manager.
4. Associating Object Repositories to an Action/Test
Resources>Associate repositories>click add icon (+)>browse path of the
repository>Associate with an action>click ok

5. Merging Repositories
Resources > object repository manager>tools>object repository merge tool
>browse

path

of

repository>click

the

ok>click

first

repository>

close>save

the

browse
merged

path

of

the

second

repository>close

the

repository manager.
Note: After merging also, source repository files will be available, if we do not
want source files we can delete.
6. Defining New Test Objects
Navigation: Object>Define new test object >Select Environment>Select Class
of the object>Enter name of the object>Click Add>click close>Select object
>select property name>enter value (like this select one by one properties and
enter values)>save
Note: This feature can be used for preparing tests before the AUT is ready.
7. Spying Objects
For getting objects information, (Test objects names, property & Values) QTP
is providing a feature called Object Spy, using this we can get objects
information.
Navigation>Tools>object spy>take hand icon & Show the object>get
information (Object Spy shows the specific objects all available properties
with their values)
Note: As Object spy is an important feature, it can be available in 3 Areas.(1.
In tools Menu 2. In local repository 3. In Repository manager)
8. View Options
Locate in Repository
This feature can be used for identifying objects from application to
repository.
Navigation: View>Locate in repository >show the object>click Ok>it
locates specified object in the repository.

Highlight in Application
This feature can be used for identifying objects from repository to
application.
Navigation : Select object in the repository > view >highlight in
application > it highlights specified objects in the application.
9. Exporting Repository to an XML file
We can export our repository file to an xml file.
Navigation : File >export Test objects to XML Enter the file name and Save
with xml extension.
10.Importing Repository from XML file.
We can import XML file to our repository.
Navigation: File>import from XML >browse path of the XML file >it loads
objects.
Note: The purpose of this feature is Editing objects information outside of the
QTP
Navigation: Resource menu>object repository (Short cut key Ctrl+R
Loading repositories during running, finding path of the repositories and
removing repositories is called Dynamic Handling of Object Repositories.
Using this feature we can increase QTP performance. To do this, QTP is
providing an object called RepositoriesCollection.
11.Syntax for Loading a Repository:
RepositoriesCollection.Add Path of the Repository File
12.Syntax for finding Position of the Repository:
Variable=RepositoriesCollection.Find(Path of the Repository)
13.Syntax for Removing the Repository:
RepositoriesCollection.Remove(position)
14.Syntax for Removing All Repositories:
RepositoriesCollection.RemoveAll

Das könnte Ihnen auch gefallen