So far All I have seen is different ways to save an existing image as an attachment to Quality Center (QC). That's fine, but is there a way to directly save an image as an attachment to Quality Center?
So for example, I have set specific areas in my automation framework to capture an image using something like:
browser("title:=.").page("title:=.").CaptureBitmap [fullname,override]
This would require to get the path of the folder in Quality Center, but I'm not sure how, is this possible? I would like to save it under a folder in the Test Plan section of Quality Center.
Ok I got it! You can save it to the temp folder which exists on every machine. Then save it to QC!
Dim oWsh, strTempFolderPath, strFilePathToSave, QCConnection, treeManager
Dim LocalFilePath, Screen1, node, att, atta
Set oWsh = CreateObject("WScript.Shell")
strTempFolderPath = oWsh.ExpandEnvironmentStrings("%Temp%")
strFilePathToSave = strTempFolderPath & "\Test1.png"
browser("title:=.*").page("title:=.*").CaptureBitmap strFilePathToSave,True
Set QCConnection = QCUtil.QCConnection
Set treeManager = QCConnection.TreeManager
' Specify the local path to the file.
LocalFilePath = strFilePathToSave
' Specify the Quality Center path to the desired folder
Screen1 ="Subject\Path to the folder where you want to save it\"
Set node = treeManager.nodebypath(Screen1)
set att = node.attachments
Set atta = att.AddItem(Null)
atta.FileName = LocalFilePath
atta.Type = 1
atta.Post()
Set oWsh = nothing : set QCConnection = nothing : Set treeManager = nothing
Set node = nothing : set att = nothing : set atta = nothing