This article is guest blogged by QTP Blog reader Naveen Nischal from Noida, India. It will come in 2 parts. This is part I of the series. Here is your chance to be a guest writer.
With the launch of QTP 9.x series, HP has made some major enhancements with QTP object repository (i.e the way QTP stores recorded objects.)
I would discuss here some imp points regarding the two object repositories, local and shared.
Local (earlier it was Per-Action) — stores objects in a file that is associated with one specific action, so that only that action can access the stored objects. When you use a local object repository, QTP uses a separate object repository for each action. The local object repository is fully editable from within its action.
Shared (same name earlier) — stores test objects in a file that can be accessed by multiple tests (in read-only mode).
Now in QTP 9.x* series you can associate an action with:
- local object repository OR
- shared object repository OR
- local and one or more shared object repository OR
- two or more shared object repositories.
Since you can associate an action with one or more repository, there can be a conflict situation when object with the same name is present in two or more object repositories. Here are some simple rules to remember so as you would never be confused:
- If an object with the same name is located in both the local object repository and in a shared object repository associated with the same action, the action uses the local object definition.
- If an object with the same name is located in more than one shared object repository associated with the same action, the object definition is used from the first occurrence of the object, according to the order in which the shared object repositories are associated with the action.
Also remember that
- if an action is associated with a local and shared repository, QTP will add new objects to the local object repository while recording operations and NOT to the shared one.
- If an object is already present in either of the two repositories, QTP will not add any object and instead use the existing information.
- QTP automatically moves a parent object(if it is in shared) to local object repository, if the child is added to the local repository.
*QTP 9.x series means QTP 9.0/ 9.1/ 9.2/ 9.5
We will discuss differences and enhancements in 9.x series Object Repository over the previous versions in Part II .
Source: QTP Documentation
Related:
Difference between QTP 8.x and QTP 9.x
Improvements in QTP 9.5
How QTP identify objects
Hi, can u plz tell why when we add same object in a page, it will come as : object, object_2, object_3
Hi,
I want to programmatically delete my local object repository, is it possible, if yes can you provide me the solution..
Thanks
Uday
Hi Ankur
I add some object to shared object repository and save file and close it, suppose I want to add some more object to same shared object repository but this time shared object repository in disable mode
Can you help me
How to associate’s sor file in qtp by script ?
i had written this script but some error app.Test.Actions.Item(1).ObjectRespositories.add (“D:\Tests\FW\SharedObject\Flight.tsr”)
ple help me soon thanks in advance..
Hi,
can u tell me How can we share objects between two Object repositiries(i.e shared or local ) in qtp.
what is object repository in qtp?
Hi,
I have Shared OR associated to my test. and the objects are automatically populating when type, Browser(, page(, etc., After scripting done, I ran the test and getting error message as below.
“The Object not found in your application” Application is kept open where it has to test. I can see the Object is available. why this error message is displayed and how to resolve it. Thanks in advance
Hi,
i am sandhya..regularly i am visting your site Re:QTP i want to join in QTP coaching.but i don’t know abt C&C++..but some people was suggesting me to that with out C,C++ knowledge we can’t learn that one..can u suggest me..QTP will help me ..in my future..
Hi Ankur,
I have one query, if we want to give same name to two different objects in Shared OR, would it be possible for the Qtp to recognise them differently in the application?
Please let me know yes or no.
Also one more query, I am migrating Winrunner scripts to Qtp through QC,could you please explain me the Object hiarchical model diffrence between WR and QTP?
I would really appreciate your help.
Thanks and Regards
Payal
how to find object, if object is not available in object repository
I am new to QTP, I am working with web application, inspite of adding objects to object repository it is saying that object not found. I have QTP 9.2 and IE 7.0.
Anybody know hoe to slove please guide me on this
Hi Ankur,
I am new to QTP, and since last 2-week I am refering this site. I have really gain good knowledge of QTP with good real examples of problem which QTP user’s are facing the same.
I have one suggestion, as the end User of this site I am learning new on each link which is provided on this portal, but it would really better if we any think like index of structure… which give bifurcate this use full material as Beginner, Intermediate & Experts.
Because many times I wend in those topic some basic fundamentals are missing…
And by structuring in similar way, One can refer this blog as Online Book , which get regularly updated with latest news & changes in QTP
This is just a suggestion.
Hi,
I have an action with object repository (let say there are 1,2,3,4,5,6 objects). Now further I split this action into 3 parts.
Now my question is, All 6 objects will be associated with all three actions or it will be divided according to the actions. (I mean if objects 1,2 is required for action1, objects 3,4 is required for action2 and objects 5,6 is required for action3)
Ankur,
If I type, Browser(…), I am getting automatically the name of the Browser that are stored in the Object Repository. Can you tell me how does this work? How OR and QTP Editor are related?
Regards
Hari
Hi ankor i have an issue i just updated from QTP 9.1 to
QTP 9.5 and have scripts written with 9.1, that when i try to run this 9.1 scripts in QTP 9.5 it takes too long i was thinking it could be that the object repository was loades in 9.1 and needs to be updated too, can this be the case?
In addition above question, how to associate if the script oppened by QC in read only mode.
Hi,
I have a query regarding Object repository.
Can we load objects in object repository for a QTP script (|||r to associating) at the runtime.
Thanks in advance,
meena
It is QTP 9.2 not ATP 9.2. Typo Error.
Hi Ankur,
We would like to create a Shared Object repository for each component in our project using ATP 9.2. Can you let me know which one of the following is the best way to create the object repository?
1. In the Object Repository Manage should I use “Navigate and Learn” option to capture all the controls on the page and delete the unwanted controls from the identified controls by QTP?
Doing so, is creating all the objects under one root directory or page. Is this Ok?
or
2. Should I use the “Add Objects” option in the Object Repository Manager to add the objects/page that I want?
Which is the best approach?
Also, do you think if it is a best practice to change the names of the controls to the user defined name?
Waiting for your response.
Thanks a lot for your help in Advance!
Ganesh
hi
iwant to know how we can create object reposirories that can share all test cases in qtp 8.2
Hi..
we have 2 environments ie one in India and the other in Client..
If I record a script for a particular application and as known that automatically objects gets stored in object repository or need to Add local Objects…
when i run the same script in Client machine..
1. Will there be any problem??
2. If Yes why? Give me the solution
3. If No Why?
Please help me out..
@Subrat: There is document at the HP support which can answer your question. It talks in detail about how to create C, C++, MFC, MFC Dialog DLL’s for use with QTP.
Having said that, declaring/calling steps would remain the same as in my post on DLL and QTP [http://www.learnqtp.com/2008/08/load-dll-with-qtp.html].
Hi Ankur,
Just wanted some clarifications on loading a dll with QTP. The example you used over here is for a notepad application. Thats a standard application and QTP is somehow able to locate its dll. But my problem is if I would like to write a class file in C# and create a dll, and follow your Extern.Declare method still QTP is unable to locate the dll.Could you please help me out in this as to how I can use my self created dll in QTP?
Thanks in advance,
Subrat