How to get a QC resource using QTP with OTA

Automation Testing Published on:
Code Hacker

In this video, I show a simple example of how to use Quality Center’s Open Test Architecture (OTA) in QuickTest Pro.

UFT or QTP using OTA to download an ALM or QC Test Resource

Code used in the video to get a QC test resource:

Function QCGetResource()

saveTo = “C:\temp”
resourceName = “FitnesseConfig.txt”

Set qcConn = QCUtil.QCConnection
Set oResource = qcConn.QCResourceFactory
Set oFilter = oResource.Filter

oFilter.Filter(“RSC_FILE_NAME”) = resourceName
Set oResourceList = oFilter.NewList
If oResourceList.Count = 1 Then
Set oFile = oResourceList.Item(1)
oFile.FileName = resourceName
oFile.DownloadResource saveTo, True
End If
End Function

* About the code:

The QCUtil object is used to access the Quality Center Open Test Architecture (OTA) interface. You can use the properties associated with the QCUtil object to return Quality Center OTA objects.  Using the property QCConnection object, allow you to interact with the current Quality Center session and provides access to the Quality Center object model.

The QCResourceFactory object allows you to manage the QC resources section.  You can use the Filter property to locate the resource that you want. Then the Filter’s NewList method is used to create a list of objects according to the specified filter.

To save and retrieve files from a QC test set ‘attachment' tab check out:QC & QTP – How to Attach a File to a Test Sets Attachment Tab

Code Hacker