In this video I show a simple example on how to use Quality Center’s Open Test Architecture (OTA) in QuickTest Pro.
Code used in video to get a QC test resource:
saveTo = "D:\DEMO"
resourceName = "QCGETRESOURCE.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
* 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

{ 5 comments… read them below or add one }
Just wondering if you knew how to download a specific baseline of a Resource?
The DownloadResource functionality only appears to get the latest and not a specified version. At runtime I want to check whether a test is “pinned to baseline” from QC which I believe I can do through the Test.VCS properties but I cannot see how to then use that to grab it’s resources of the same baseline?
Gareth » HI Gareth – I’m not sure. I will have to try and see if I can figure it out. I’ll let you know what I find. Please let me know if you find a solution first.Cheers~Joe
How can you change this to download a file attached to a test?
Joe,
Need your help.
Goal : To load a function library stored in QC Resource from qtp script which has been called from QC Run test set.
1. Mt QTP script thats been attached to each QC tests will attempt tp load function library and use its methods.
2. This was working before for me since I was storing all my function libraries & datafiles under QTP’s machine.
3. Now I want to use QC’s resource folder since it can be accessed by all team members and moved the function libraries to QC path “[QualityCenter] Resources\My Automation Resources\Mastercript\”.
4. When I attempted to LoadLibrary by providing the QC path, it not taking.
5. Could you please help on how to load function library from resource that can be used in the current qtp script initiated from QC ?
‘———————————————————————————
‘Before using QC : Worked for me
g_qc_framework_root = C:\\My Automation Resources\Mastercript\”
LoadFunctionLibrary g_qc_framework_root & “main_driver_lib.vbs”
‘———————————————————————————
‘Afterusing QC : FAILS
g_qc_framework_root = “[QualityCenter] Resources\My Automation Resources\Mastercript\”
LoadFunctionLibrary g_qc_framework_root & “main_driver_lib.vbs”
Thanks
Murali
Murali » Hi Murali – I have to try a few things to see how to do this. Dumb question have you tried just opening the QTP script and in File>Settings under Test Settings click on resources? In the resources you can point to the function library in QC/ALM.
{ 1 trackback }