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

what are SetToProperty, SetROProperty,GetToproperty scripting?

2 Answers  


I have written a code to fetch values fro access db and place in the fields. Iam using GetROProperty to fetch runtime values. Now i want to add runtime values to the access db in field v3. please help me. Its not writting in the db. Option explicit Dim con,rs,db,c Set con=createobject("adodb.connection") Set rs=createobject("adodb.recordset") con.Open "Driver={Microsoft Access Driver (*.mdb)};dbq=D:\Sales.mdb" rs.open "select * from tax",con Do while not rs.eof Browser("Sales Tax Calculator").Page("Sales Tax Calculator").WebEdit("incost").Set rs.fields("v1") Browser("Sales Tax Calculator").Page("Sales Tax Calculator").WebEdit("intax").Set rs.fields("v2") c=Browser("Sales Tax Calculator").Page("Sales Tax Calculator").WebEdit("outtax").GetROProperty("value") rs.MoveNext print c Loop Do while not rs.EOF rs.EditMode rs.Fields("v3").Value="3" rs.Update rs.MoveNext Loop Set rs=nothing Set con=nothing

0 Answers  


what are the drawbacks for record and payback in qtp

3 Answers  


I want to write some certification courses, so friends could you guide me? which certification is best and how to write exam and what tutorials need to be studied,what to do first, I am working on automation tool QTP 9.2

0 Answers   Livetek,


How to parameterize in QTP?

4 Answers  






If you are using descriptive programming and you have two objects with the same name, so you are identiying them by name and index, how can you avoid errors if a third object with the same name is added at the begining of the page?

4 Answers  


Question:how many types of repositories in QTP9.2?and explain??

3 Answers  


I am Facing Issues with learing datepicker 1)when i first learn datepicker as current system date . 2)if i wanna runtime datepicker value it gives error

0 Answers  


How do u fetch data from a database ?

2 Answers  


Hi, OUR PROJECT NAME IS: HOSPITAL CONTROL SYSTEM. IS IT COMES UNDER WHICH DOMAIN(HEALTH CARE OR HEALTH INSURANCE)

4 Answers   Four soft,


Set DR= CreateObject("Mercury.DeviceReplay")

2 Answers  


Did QTP prove efficient for your project? Yes or No, explain?

0 Answers  


Categories