Showing posts with label Working with Object Repository. Show all posts
Showing posts with label Working with Object Repository. Show all posts

Sunday, January 11, 2009

Script for adding and ramoving Object repository to an action

Here i have written two functions for adding and removing Object Repositories for an action call these function with object repository path.
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
'Adding Repository to an action
Function AddRepositorytoCurrentAction(RepPath)

Dim qtApp,qtRepositories, actName

actName=Environment.Value("ActionName")

Set qtApp = CreateObject("QuickTest.Application")
Set qtRepositories = qtApp.Test.Actions(actName).ObjectRepositories

If qtRepositories.Find(RepPath) = -1 Then
qtRepositories.Add RepPath, 1
End If

If rmvPosition<> -1 Then
Reporter.ReportEvent micPass,"Adding Object Repository","Object Repository is Succesfully Added to the Action "&actName
else
Reporter.ReportEvent micFail,"Adding Object Repository","Object Repository is not Added to the Action "&actName
End If

qtApp= Nothing
qtRepositories= Nothing
End Function

'Remove repository from an action
Function RemoveRepositoryfromCurrentAction(RepPath)
Dim qtApp,qtRepositories, actName

actName=Environment.Value("ActionName")

Set qtApp = CreateObject("QuickTest.Application")
Set qtRepositories = qtApp.Test.Actions(actName).ObjectRepositories

rPosition=qtRepositories.Find(RepPath)

qtRepositories.Remove rPosition

rmvPosition=qtRepositories.Find(RepPath)

If rmvPosition= -1 Then
Reporter.ReportEvent micPass,"Removing Object Repository","Object Repository is Succesfully Removed From the Action "&actName
else
Reporter.ReportEvent micFail,"Removing Object Repository","Object Repository is not Removed From the Action "&actName
End If

qtApp= Nothing
qtRepositories= Nothing

End Function

'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

About Me

My photo
Hi all,I am Arun Singh Rajaputra. I am working as a Project Lead in a reputed organization in Hyderabad, AP, India. I have little bit knowledge on Quick Test Professional and like to share my knowledge to all through this blog.

Subscribe to get updates on this blog

Enter your email address:

NOTE

Some of the posts posted in this blog are collected and most of them have been prepared by me. If any one have objections regarding any copied posts. Please mail me so that I can take a necessary action on that post.