Facebook

For any corporate training requirements Please mail To sudhakar@qtpsudhakar.com
New Schedule in MindQ Systems, Madhapur By SUDHAKAR
Course Name Date Time Duration Type Branch
Selenium+Appium 16th October 2017 7.30 AM - 9.00 AM IST 45 Days ClassRoom + Online Mind Q Madhapur
Selenium+Appium 30th October 2017 9.30 AM - 11.00 AM IST 45 Days ClassRoom + Online Mind Q Madhapur

A book "Cracking the QTP interview" authored by Sudhakar.Read More. Buy From FlipKart

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