0
將自動化設置爲在本地保存文件,然後我需要將其上傳到QC項目中的特定位置(以便稍後再次檢索) ,使用QTP腳本。通過QTP腳本將文件上傳到QC中的特定文件夾
有關如何做到這一點的任何想法?
非常感謝。
乾杯。
將自動化設置爲在本地保存文件,然後我需要將其上傳到QC項目中的特定位置(以便稍後再次檢索) ,使用QTP腳本。通過QTP腳本將文件上傳到QC中的特定文件夾
有關如何做到這一點的任何想法?
非常感謝。
乾杯。
谷歌是你的朋友。例如,從http://h30499.www3.hp.com/t5/Quality-Center-Support-and-News/How-to-upload-a-any-type-of-file-to-quality-center-using-QTP/td-p/5297523#.UfpIs5JM_eQ下面的腳本看起來像一個答案,是谷歌搜索「上傳文件QC QTP」的首歌曲之一:
Dim localFolderPath
localFolderPath = "Local folder path of library files"
call UploadFilesToQC("Subject\BPT RESOURCES\QC Folder Name", localFolderPath)
Public Function UploadFilesToQC(strQCPath,strFilesystemPath)
Dim fileCount, timeNow, timeOld, timeDiff
fileCount = 0
'Get QC connection object
Set QCConnection = QCUtil.QCConnection
'Get Test Plan tree structure
Set treeManager = QCConnection.TreeManager
Set node = treeManager.NodeByPath(strQCPath)
Set AFolder = node.FindChildNode("Library Files") ' Library Files folder Name in QC
set oAttachment = AFolder.attachments
timeOld = Now
Set fso = CreateObject("Scripting.FileSystemObject")
Set oFolder = fso.GetFolder(strFilesystemPath)
Set oFiles = oFolder.Files
'Iterate through each file present in File System path
If oFiles.count >0 Then
For Each oFile in oFiles
Set attach = oAttachment.AddItem(Null)
attach.FileName = oFile.Path
attach.Type = 1
attach.Post()
fileCount = fileCount +1
Set attach = nothing
Next
timeNow = Now
timeDiff = timeNow - timeOld
'Time required to upload all files to QC
Reporter.ReportEvent micDone,"Time required to upload : ", "'" & timeDiff & "' minutes."
'Total Files count uploaded to QC
Reporter.ReportEvent micDone,"Total files uploaded : ", "'" & fileCount & "' files uploaded."
else
Reporter.ReportEvent micFail,"File not found", "No file found at path: " & strFilesystemPath
End If
End Function
多謝TheBlastOne。一如既往的很有幫助。 – Pixie
不要感謝,接受! :D – TheBlastOne
我還沒有接受,因爲我還沒有嘗試過呢!但我會明確地幫忙,所以確定;) – Pixie