【问题标题】:HP ALM - download a resource under a specific folder in the Test Resource moduleHP ALM - 下载测试资源模块中特定文件夹下的资源
【发布时间】:2017-09-15 16:37:31
【问题描述】:
我们正在使用 ALM 12。我们的测试资源模块中有多个文件夹,并且这些文件夹中存储的一些资源与其他文件夹中的名称相同。我可以使用该名称下载资源,但不知道如何在特定文件夹下获取资源。任何人都知道如何下载指定要从哪个文件夹下载的资源?
例如
文件夹 1
我的表格.xls
文件夹 2
我的表格.xls
我想下载 Folder2\mysheet.xls 而不是 Folder1\mysheet.xls
【问题讨论】:
标签:
alm
hp-quality-center
【解决方案1】:
您可以通过资源 id 而不是资源名称来下载资源。
以下是 VBS 示例(带有 OTA API)供您参考:
Option Explicit
Dim tdc, cust, resource
set tdc = CreateObject("TDApiOle80.TDConnection")
tdc.InitConnectionEx "http://YourALMServer:Port/qcbin"
tdc.Login "username", "password"
tdc.Connect "domainName", "projectName"
# 1001 is the resource id which you want to download.
set resource = tdc.QCResourceFactory.Item("1001")
# "C:\\tmp\\" is the local path where you want to place the downloaded resource
resource.DownloadResource "C:\\tmp\\", TRUE
tdc.Disconnect
tdc.Logout
tdc.ReleaseConnection
【解决方案2】:
Option Explicit
Dim objCon, cust, resource
set objCon= CreateObject("TDApiOle80.TDConnection")
objCon.InitConnectionEx "http://YourALMServer:Port/qcbin"
objCon.Login "username", "password"
objCon.Connect "domainName", "projectName"
Set oResourceFolder = objCon.QCResourceFolderFactory
Set oFilter = oResourceFolder.Filter
oFilter.Filter("RFO_NAME") ="abc" \\ abc is your folder name
Set oList = oFilter.NewList()
set oChild = oList.item(1).QCResourceFactory.NewList("")
''assuming that there is only 1 folder with name "abc" in Test Resources section
For i =1 to oChild.count Step 1
oChild.item(i).DownloadResource "c:\\a", TRUE
''c:\\a is the location where we need to safe the resource
next
set objCon = Nothing