haripotter’s technorati

Just another WordPress.com weblog

How do we use QC as Shared repository… ?

There was comment posted in this blog asking if we could use QC as a shared repository to store file and update it directly, without downloading to local desktop. I’m afraid that it is not possible to do without downloading the file to local desktop. But We certainly can use QC as a shared repository to store files and have it accessible to many tests. There are cases when multiple QTP tests may have a need to access the same file which is stored in the test’s project repository in QC. When we attach the file to a test, other tests will have to access this attachment through this test. Alternatively, a copy of the same file could be attached to each and every test. That would be a maintenance nightmare. So what would be the solution ? Read on…

We could use the ExtendedStorage object in OTA API to transport files that are not attachments.
This ExtendedStorage Object allows us to transport files between QTP client and the QC server without having to attach files to specific Quality Center (QC) entities (such as a test).

The following code will upload a file called Trial.mdb from the QTP client to the project repository in QC

Set currentTest = QCUtil.CurrentTest
Set attachmentFact = currentTest.Attachments
Set extendedStorage = attachmentFact.AttachmentStorage
extendedStorage.serverpath = extendedStorage.serverpath
extendedStorage.clientpath = “C:\”
extendedStorage.save “Trial.mdb”, true

The following code can be used to download a file from the project repository to C:\ of the QTP Client:

Set currentTest = QCUtil.CurrentTest
Set attachmentFact = currentTest.Attachments
Set extendedStorage = attachmentFact.AttachmentStorage
extendedStorage.serverpath = extendedStorage.serverpath
extendedStorage.clientpath = “C:\”
extendedStorage.load “trial.mdb”, true

Notes:

  • There will not be any error message if the file does not exist in the server.
  • The file will not be visible from the QC user interface as it is not attached to any QC entity (such as a test). It will, however, exist in the project repository folder on the server.
  • The QTP test must first be saved in QC for the “currentTest” method to return an object.
  • August 3, 2008 - Posted by haripotter | HP Quality Center and QTP | , , , | No Comments Yet

    No comments yet.

    Leave a comment