Adding OR to the script when script runs from QC
I have a problem with loading of shared Object Repository when script is executed from the Quality Center. I load the OR using a function call from the script:
'To load Object Repository to each Action using exact Object Repository path
Function Load_Object_Repository_Path( sOR )
Dim App 'As Application
Set App = CreateObject("QuickTest.Application")
'Collect the number of Actions present in the Test
NumberOfActions = App.Test.Actions.Count
Reporter.ReportEvent micDone, "Load_Object_Repo", "after Number of actions is obtained"
'Loop untill you get all the actions
For I=1 to NumberOfActions
'Get the name of action for which the Shared OR has to be loaded
ActionName = App.Test.Actions(I).Name
Reporter.ReportEvent micDone, "Load_Object_Repo", "after ActionName is obtained"
'Get the object repositories collection object of the action
Set qtRepositories = App.Test.Actions(ActionName).ObjectRepositories
Reporter.ReportEvent micDone, "Load_Object_Repo", "after object repositories collection is obtained"
'Add the repository to the collection if the repository cannot be found in the collection
If qtRepositories.Find(sOR) = -1 Then ' If the repository cannot be found in the collection
Reporter.ReportEvent micDone, "Load_Object_Repo", "before repository is added to collection"
qtRepositories.Add sOR, 1 ' Add the repository to the collection
Reporter.ReportEvent micDone, "Load_Object_Repo", "after repository is added to collection"
Reporter.ReportEvent micDone, "Load OR File", "OR File from location '" & sOR & "' has been loaded to Action: " & ActionName
Set qtRepositories = Nothing 'Free action's shared repositories collection
Set App = Nothing 'Free the Application Object
Since script that is executed from Quality Center runs in read-only mode I am getting the error message: "Cannot perform the operation because the action is a read-only action" in the line qtRepositories.Add sOR, 1
If I associate the OR with the script itself through Resources > Associate Repositories dialog, OR is loaded and script runs fine. Even though this runs fine, I still prefer to load OR programmatically since the location of OR in Quality Center might change and I do not want to have to change values for associated OR in the script.
I am using QTP 9 and Quality Center 9. The similar approached worked with version 8; the call to load OR has been slightly changed however.
1. Is it somehow possible to set Quality Center and QTP so script executed from Quality Center is not in read-only mode
2. Is there any other possible way to load OR programmatically that would work when script is loaded from Quality Center and it is in read-only mode.
Thanks a lot,
Re: Adding OR to the script when script runs from QC
could you please provide me some feedback about the question. Do you understand what I am trying to accomplish here?
Is anybody else running QTP 9 scripts from Quality Center 9, and loading the shared Object Repository from Qaulity Center?