How can we add objects to object repository during run time?
Note : This is the question asked by a visitor thirupathi. I am posting this in proper forum.
How can we add objects to object repository during run time?
Note : This is the question asked by a visitor thirupathi. I am posting this in proper forum.
we can add objects during runtime by using SetROPROPERTY
if u want to add it run time then go for setroproperty
please give the example for add objects to OR during runtime?
by writing the descriptive programing we can add the properties at run time.
if u want example i will send it to later .
Can anybody plz send a sample code for this???
Last edited by jainbrijesh; 07-06-2007 at 04:43 AM.
Hi Debleena,
Yes we can add Objects at runtime to the OR. You would have to open the OR at runtime and in a updatable mode.
Check out this code for the same -
Set QtApp = CreateObject("QuickTest.Application")
Set QtTestResources = QtApp.Test.Settings.Resources
QtTestResources.Load{Path of the Repository to be Opened}, mode
mode would be readOnly or Updatable.
Once you have the OR loaded use,
Add method and pass Obejct as parameter.
Dear Prasad and vijaysagar,
Unfortunately we dont have SETROPROPERTY method in QTP.
Last edited by rajaputra; 12-26-2007 at 08:40 AM.
Rajaputra, yes, but please explain why we need "mode" at the end of the code.rajaputra said...
QtTestResources.Load{Path of the Repository to be Opened}, mode
mode would be readOnly or Updatable.
What does your code do exactly? It seems incomplete to me. Does it "load OR during run-time" or does it add objects to OR during run-time?
Hi Anshoo,
It will load OR during runtime.
Here mode will be updatable. Becuase we want to add objects to the OR. So, OR should be in updatable mode. If it is in readonly mode we cannot add object / modify ObjectRepository.
Thats why we required mode.
Hai Rajaputra,
I have a doubt regarding the code. I am using QTP 9.5. While using the code an error message is being displayed that Object doesn't support this property or method. As for my reference through QTP Help, I observed that we can load object repository to the objectrepositoryutil object. Can u please give me clrification on this. I need it immediaely.
Thanks,
Siva
Hi Babsun,
you can use below method to add object repository to your test.
Repositoriescollection.Add "RepositoryPath"
Here, RepositoryPath is path of the object repository
__________________
Thanks & Regards!!
RAJAPUTRA