我尝试在其中存储测试文件(pdf、docx、jpg)ALM
并将它们用作上传测试的输入文件。我不确定,我如何将文件复制到ALM
以及之后如何从UFT
.
问问题
213 次
1 回答
2
网上有很多例子
Function get_ALM_Resources(gstr_FrameWorkPath,gstr_Resourcename,gstr_Foldername)
'Dowload files from ALM TestResource
Set objqcConn = QCUtil.QCConnection
Set lobj_Resource = objqcConn.QCResourceFactory
Set lobj_Filter = lobj_Resource.Filter
lobj_Filter.Filter("RSC_FOLDER_NAME") = gstr_Foldername
lobj_Filter.Filter("RSC_FILE_NAME") = gstr_Resourcename
Set lobj_ResourceList = lobj_Filter.NewList
If lobj_ResourceList.Count <>0 Then
Set lobj_oFile = lobj_ResourceList.Item(1)
lobj_oFile.FileName = gstr_Resourcename
lobj_oFile.DownloadResource gstr_FrameWorkPath, True
End If
End Function
Public Function fn_QCDownloadResource(sFileName, sDestination)
Dim objQC, objRes, objFilter, objFileList, objFile, sFilterPair, iCount
If Not QCUtil.IsConnected Then
Exit Function
End If
Set objQC = QCUtil.QCConnection
Set objRes = objQC.QCResourceFactory
Set objFilter = objRes.Filter
objFilter.Filter("RSC_NAME") = """" & Cstr(sFileName) & """"
Set objFileList = objFilter.NewList
If sDestination = "" Then
sDestination = sDestination
End if
If objFileList.Count = 1 Then
Set objFile = objFileList.Item(1)
objFile.FileName = sFileName & ".xlsx"
objFile.DownloadResource sDestination, True
End If
Set objQC = Nothing
Set objRes = Nothing
Set objFilter = Nothing
Set objFileList = Nothing
Set objFile = Nothing
End Function
Function DownloadQCAttachment(strQCDir, strFileName, strTargetPath)
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = QCUtil.QCConnection.TreeManager.NodeByPath(strQCDir)
Set objAttachmentList = objFolder.Attachments.NewList("")
For Each objAttachment In objAttachmentList
If InStr(1, objAttachment.DirectLink, strFileName, 1) > 0 Then
Set objExtStorage = objAttachment.AttachmentStorage
objAttachmentName = objAttachment.DirectLink
objExtStorage.Load objAttachmentName, true
objFSO.MoveFile objExtStorage.ClientPath & "\" & objAttachmentName, strTargetPath & "\" & Split(objAttachment.Name, "_")(UBound(Split(objAttachment.Name, "_")))
Exit For
ElseIf strFileName = "" Then
Set objExtStorage = objAttachment.AttachmentStorage
objAttachmentName = objAttachment.DirectLink
objExtStorage.Load objAttachmentName, true
objFSO.MoveFile objExtStorage.ClientPath & "\" & objAttachmentName, strTargetPath & "\" & Split(objAttachment.Name, "_")(UBound(Split(objAttachment.Name, "_")))
End If
Next
Set objFSO = Nothing
End Function
于 2018-04-23T04:32:26.623 回答