Object Repository Concept in qtp :
Object Repository: It is a place where qtp stores the objects(Ex:buttons or Check Boxes) information.
There are two types of Object Repositories
1.Local Object Repository
By default if we record any test,that goes to Local Object Repository.
We can edit or delete object properties. Only that test can use that object repository.
2.Shared Object Repository
If we create shared object repository,other tests can also
use that shared object repository. We can’t edit object properties.
To get more concepts on this.Go through below cases
1.How to create shared object repository in qtp
Open Blank Test
Goto Resources–Object Repository Manager
Object—Add Objects
–>Open ur application and add objects of the application
save it anywhere in ur pc.
the extension would be .tcr
Shared Object Repository Example :
Open Blank Test
Goto Resources–Object Repository Manager
–>open ur Flight Reservation Application
object–Add objects
–>add objects of ur application
1.add Agent Name edit box
2.add Password edit box
3.add ok button
File–Save
2.How to use shared object repository inqtp
Goto Resources–Associate Repositories
One Associate Repositories window appears
There click on + symbol to browse the shared object repository
Goto Available actions,bydefault Action1 would be present
click on action1 and then click on > button
It will add to Associated Actions
Click ok.
Now u can open local object repository and view the objetcs that
u added through shared object repository.
We can’t edit or delete those objects properties and values.
Now u can write ur testcase in expert view and execute
dialog(“Login”).WinEdit(“Agent Name:”).Set “venkatesh”
dialog(“Login”).WinEdit(“Password:”).Set “mercury”
dialog(“Login”).WinButton(“OK”).Click
3.How to export local object repository into shared object repository in qtp
Open Blank Test
Goto Resources–>Object Repository
Open ur Flight Reservation Application
Goto Object–Add objects to Local
Add ur application objects to ur test
In the same object repository window
Goto File—Export Local Objects. It saves as .tsr file
So that anyone can use that .tsr file.
It is not possible to convert local repository to shared repository but by using the data in local repository we can create shared repository
Yes.You are correct.We can’t convert local object repository to shared object repository.
Thanks for ur comment
I want to know how to add “window” in object repository?
Hi,
To add whole window to object repository.
Goto–Resources–Object Repository.
There in the new window,goto
Objects–Add Objects to Local,there you need to click
on the top of the window of your application.
Then qtp will add all the objects of the window to
object repository
Hi
Using this,browser is adding in my Object repository.But I want to add the window of Internet explore in Object repository as I want to capture the tool tip of the hyperlink.
Hi,
If objects are not able to identify,then goto tools–Internet Options–settings–
disable the icon of –Enable Tabbed Browsing
Eventhough objects won’t identify in ie
goto user accounts–Change user account control settings
–drag the icon to never identify
How to associate a object repository to a script at runtime?
we can add object repository at runtime
Two ways are there u can add
1. when u write below syntax in Action1
Syntax: RepositoriesCollection.Add(Path)
Ex: RepositoriesCollection.Add(E:\OR\ObjRes.tsr)
if write in Action1 it will automatically add the Object
Respository to the Action1
(i.e Edit Menu–>Action–>Action Properties–>Associate
Repository tab) at runtime.
no need to add the object repository before running.
2. Add the object repository at runtime by using AOM
(Automated Object Model)
Ex:
Dim qtAppn
Dim qtObjRes
Set qtAppn = CreateObject(“QuickTest.Application”)
qtAppn.Launch
qtAppn.Visible = True
qtApp.Open “E:\Test\Test2″, False, False
Set qtObjRes = qtApp.Test.Actions
(“Login”).ObjectRepositories
qtObjRes.Add “E:\OR\ObjRes.tsr”, 1
The above example Add the Object Repository(ObjRes.tsr) to
the “Login” action in Test2.
Here also no need to add the object repository in Test2.
can u provide some examples for Virtual objects?