Re: Export Test cases from QC to Excel with Attachment
use something like this...this is for defects but should work with tests also
Set oAttFact = oBug.Attachments
Set oAttList = oAttFact.NewList("")
For Each oAtt In oAttList
'downloads the attachments to sPath which you cannot change
oAttCH.Load True, sPath
'after this I would use the Microsoft Scripting Runtime FSO.CopyFile to move it to a location of your choice.
try this. Suppose oTest is the TestObject you're analyzing.
'This part must be out of the for cycle I suppose you're doing.
Dim myExtStor, strAllPath, myPath
strAllPath = ""
'End of the part out of the cycle
'This is inside the for cycle
set myExtStor = oTest.ExtendedStorage
'this return the Extended Storage Object that has the Load Method
'this method returns a string that is the path where attachment are downloaded into the client
'I've never use it so I hope it works
myPath = myExtStor.Load("*.*", False)
'I build the strAllPath as this:
strAllPath = strAllPath & oTest.Name & " || " & myPath & vbNewLine
out of the for cycle you get a variable (strAllPath) that contains for each Test the Path Location in you client where the attachments have been downloaded. To analyze the strAllPath I use 2 split functions, the first on vbNewLine char (chr(13)) and the second on " || " chars.
arrAllPath = split(strAllPath, chr(13))
for i = 0 to ubound(arrAllPath)
arrRow = split(arrAllPath(i), " || ")
strTestName = arrRow(0)
strClientPath = arrRow(1)
It's much simpler to create two OTA connections - one to the old project and one to the new project - and then use the isupportcopypaste interface to copy and paste test plan test from one project to the other.
Using this method will also transfer attachments.
Alternatively, open both instances in two separate browser windows, and manually copy from one to the other.
Both methods will take time, but it's much simpler than dealing with the attachments via the attachment factory etc.