how do you remove object repository at runtime and load
object repository and verify it

Answers were Sorted based on User's Feedback



how do you remove object repository at runtime and load object repository and verify it..

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

how do you remove object repository at runtime and load object repository and verify it..

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

Post New Answer

More QTP Interview Questions

why do we use both location and index identifier.

2 Answers   Polaris,


What is the limitation to XML Checkpoints?

0 Answers  


Do we get any issues if we run the test script on differentbrowsers?what are the options we need to set in QTP?

3 Answers   CTS,


What are the challenges u faced in testing with crm domain? How u overcome with?

0 Answers  


how can i sent QTP results to the Html, notefile ,xl file give me the code using g mail login page

0 Answers  


We need to verify the user name & password in for the user validation. But we don't want to use the parameterization/ loop for user name and password. What is the way in scripting so that user & password will generate automatically.

11 Answers   Tech Mahindra,


what is the difference between parameters and arguments?

1 Answers  


Is it possible to check the Run time value property of a field through a Database Checkpoint ? Further, is it possible to localize and mention a particular cell , in the database dynamically. My requirement is that I would need to check the status of a particular field , that would change from an "Active" state to a "Stopped" state dynamically.

1 Answers   CTS,


What is the difference between QTP 8.2 and QTP 9.2 ?

4 Answers   IBM, Infotech,


How to create Userdefined Function.Please write the steps ans also provide example where exatcly we use it.

1 Answers   HP,


Q- what is the advantage of merging tool in QTP 9.2?

1 Answers   TCS,


what is error and fault in terms of software quality?

0 Answers   TCS,


Categories