I was using below code to download attachments for test cases at the HP ALM TestLab
folder,
But then I find out that attachments can be available at the step level too.
So is there any way to download attachments for test steps?
I tried with changing 2nd line to
TDAPIOLELib.StepFactory tsTestFact = tDConnection.StepFactory;
But it was not working.
public void DownloadTestAttachments_FromVB_TestLab()
{
String AttachmentDownloadPath = @"C:temp";
TDAPIOLELib.TSTestFactory tsTestFact = tDConnection.TSTestFactory;
TDAPIOLELib.List tsTestList = tsTestFact.NewList("");
TDAPIOLELib.AttachmentFactory attFact;
TDAPIOLELib.List attList;
Console.WriteLine("Downloading attachments for the Tests : " + AttachmentDownloadPath);
try
{
foreach (TDAPIOLELib.TSTest tsItem in tsTestList)
{
if (tsItem.HasAttachment == true)
{
attFact = tsItem.Attachments;
attList = attFact.NewList("");
foreach (TDAPIOLELib.Attachment attItem in attList)
{
attItem.Load(true, AttachmentDownloadPath + "\" + attItem.Name);
}
}
}
}
catch (Exception x)
{
Console.WriteLine(x.ToString());
}
}
Source: Read More