Add attachment to Test Case Result using TFS API

We can add attachment to test case result using TFS APIs. Here is small code snippet I have created.

ITestRun testRun = _plan.CreateTestRun(false);
ITestCaseResultCollection results = testRun.QueryResults();
ITestIterationResult iterationResult;
 
foreach (ITestCaseResult result in results)
{
     result.Attachments.Add(new Attachment("FileName", "Comments if any"));
}
 
results.Save(true);
testRun.Save();
testRun.Refresh();

Comments

Popular posts from this blog

How To: Bulk upload Test Case results to Microsoft Test Manager

TFS API: Get Work Item History Revisions for parituclar Field