Wednesday, June 26, 2013

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();

No comments:

Post a Comment