Facebook

Course Name Start Date Time Duration Registration Link
No Training Programs Scheduled ClickHere to Contact
Please mail To sudhakar@qtpsudhakar.com to Register for any training

Thursday, June 25, 2009

Add and Remove Repositories to an Action In RunTime


Associate and Dissociate Object Repositories for An Action In RunTime

'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
 


2 comments :

  1. How to add a New Action to a Test using "Automation Object Model". Please let me know. thanks. 9841313748 / thanga@gmail.com

    ReplyDelete
  2. Object repository extension spelled as TRS than TSR.

    ReplyDelete