how do you remove object repository at runtime and load
object repository and verify it
Answers were Sorted based on User's Feedback
Answer / ravindra
'Adding Repository to an action
'*********************************************************************
Dim qtApp,qtRepositories, actName, RepPath
RepPath=".TRS File Path"
actName=Environment.Value("ActionName") 'Get Action Name
Set qtApp = CreateObject("QuickTest.Application") ' Create Application Object
Set qtRepositories = qtApp.Test.Actions(actName).ObjectRepositories ' Get Associated repositories list
If qtRepositories.Find(RepPath) = -1 Then
qtRepositories.Add RepPath, 1 ' Add the Object Repository to the current action
End If
qtApp= Nothing
qtRepositories= Nothing
'*********************************************************************
'*********************************************************************
'Remove repository from an action
Dim qtApp,qtRepositories, actName, RepPath, rPosition
RepPath=".TRS File Path"
actName=Environment.Value("ActionName") 'Get Action Name
Set qtApp = CreateObject("QuickTest.Application") ' Create Application Object
Set qtRepositories = qtApp.Test.Actions(actName).ObjectRepositories ' Get Associated repositories list
rPosition=qtRepositories.Find(RepPath) 'Find the Position of the Repository
If rPosition<>-1 then
qtRepositories.Remove rPosition ' Remove Repository From the Action
End if
qtApp= Nothing
qtRepositories= Nothing
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / uday
This you can do in two ways:
Use "RepositoriesCollection" utility object and use below
methods as per your needs.
RepositoriesCollection.remove(pathOfSharedOR)
RepositoriesCollection.add(pathOfSharedOR)
RepositoriesCollection.add(pathOfSharedOR)
Another way is using AOM.
A bit of coding is needed, so i am putting high level
overview. I am just posting a pseudo code here:
create a QTPObject
Get associaterepositories by some method like
"AssociatedRepositories"
set repositories=QTPObject.AssociatedRepositories
Once you have repositories you can use below methods like
repositories.remove (path)
repositories.add(path)
repositories.find(path)
I hope that helps.
Thanks,
Uday
http://qtpftvideos.blogspot.com/
| Is This Answer Correct ? | 1 Yes | 5 No |
if we can find the status of script in qtp that either it's pass or fail then why we need to put this status on different excel file or log file in hybrid framework .please let me know asap thanks
is we can import the object repository from external source. if it so then how?
what is the difference between QTP 8.0 & 9.0?
What is Modular framework and Keyword drive framework? Explain
How to handle recovery scenario for a application crash.write script for this.
how we can take data in the username field text box into variable in web application explain with example and give all functions to get data into variables
Please mail me the license key of QTP 9.5 t v.sadangi@gmail.com ????? thx
how to insert QTP to display errors and other description in the test results instead of halting execution by throwing error in the mid of executin due to an error (for object not found)?
what difference between client and server applications exatly?
What is our exact stage involvement with QTP?
Can we directly automate testscripts accrdoing to requirements? WHY ?
After coming to know that QTP could not identify non-standard objects, we set those non-standard objects as virtual objects using Virtual object wizard. But how can we identify that qtp could not identify non-standard objects?