Micro Focus QTP (UFT) Forums
Object Repository - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Object Repository (/Thread-Object-Repository--4739)



Object Repository - mv8167 - 04-22-2011

I created a test script and now how copied part of the old test script into a new script. Now I need to be able to use tthe Object Repository (OR) from the original test script.

In my old script, I went to Resources -> OR-Manager and Saved my OR.tsr file in MyOR directory.

Then in my new script, I wen to Resources -> OR-Manager to Open my OR.tst file, but still my scrit says no OR found.

Next I went to Resources -> Associated Rep and I added my OR.tsr, but still no luck.

How do I save and reuse my originally created OR?
Is there a way, at the opening of my scripts to tell QTP which OR's to use?



RE: Object Repository - A.Saini - 04-22-2011

HI,

To tell QTP which OR's to use, we need to associate the repository to the script. We can add multiple repositories to a script & vice versa.

Smile



RE: Object Repository - mv8167 - 04-25-2011

What is the cose I would add to select which ORs I would want to use? Can I add this directly into my script?
Or, must I use QTPs menu's to add each OR as needed?

thx


RE: Object Repository - Jay - 04-26-2011

you should be able to use OR.tsr in new script. you have two options:
1. open old OR in object repository manager and copy all the objects and then paste them into new OR
2. associate old OR to new script



RE: Object Repository - mv8167 - 04-26-2011

Thx!

So I guess I can not associate an object repository to a script with a call to a OR.tsr. In #2, how do I associate the OR.tsr to a different script?


RE: Object Repository - vIns - 04-26-2011

In ur new script can u plz try this?

Code:
strRepPath = <path of OR>   ("c:\vIns\OR.tsr")
        RepositoriesCollection.RemoveAll()
        RepositoriesCollection.Add(strRepPath)



RE: Object Repository - mv8167 - 04-28-2011

vIns,

Does the statement "RepositoriesCollection.RemoveAll()" remove the currently loaded OR and "RepositoriesCollection.Add(strRepPath)" adds the one with my OR back in? Great!

I will try hopefully soon. I just am having issues building the OR with Navigate & Learn (F6).
vIns,

I added your code:
Code:
strRepPath = P:\QTP Tests\ObjectRepository\RepositoryCTE.tsr
RepositoriesCollection.RemoveAll()
RepositoriesCollection.Add(strRepPath)
but I receive an RunError message box:
The test run cannot continue due to a syntax error.
Expected statement
Line (1):
Code:
"strRepPath = P:\QTP Tests\ObjectRepository\RepositoryCTE.tsr



RE: Object Repository - vIns - 04-28-2011

Try this ma'am

Code:
strRepPath = "P:\QTP Tests\ObjectRepository\RepositoryCTE.tsr"
RepositoriesCollection.RemoveAll()
RepositoriesCollection.Add(strRepPath)



RE: Object Repository - mv8167 - 04-28-2011

Double-Quotes, I always forget these. ;-), thaxxx vIns