|
帮我看一下这段代码,如QC资源管理中存在这个附件时能替换,但是我想实现的是上传一个新的没有的附件,需改一下,如何改?
Function QCSaveToResource(QcResourceName,fileNameToSave,fileToSavePath,resourceType,opt)
'*************************
'Upload a resource
'**************************
Set qcConn = QCUtil.QCConnection
Set oResource = qcConn.QCResourceFactory
Set oCurrentResources =oResource.NewList("")
Set oNewResource = Nothing
resourceCount = oCurrentResources.Count
For iNowResourceNum = 1 To resourceCount
nowResource = oCurrentResources.Item(iNowResourceNum).Name
msgbox nowResource
if UCase(nowResource) = UCase(QcResourceName) then
Set oNewResource = oCurrentResources.Item(iNowResourceNum)
resourceFound = "True"
end if
Next
If resourceFound = "True" Then
oNewResource.Filename = fileNameToSave
oNewResource.ResourceType = "Test Resource" ' need to replace with resourceType param
oNewResource.Post
oNewResource.UploadResource fileToSavePath, True
Else
reporter.ReportEvent micFail,"Did not find a resource in the Test Resource module named " & QcResourceName,"Verify that a resource exist in the QC Test Resource module!"
End If
Set oCurrentResources = Nothing
Set oResource = Nothing
End Function |
|