[英]Adding attachment to test case in MTM
我正在尝试在C#中使用TFS Api向MTM中的测试用例添加附件。 我没有抛出任何异常,但是仍然无法在TFS中看到上传的文件。 我正在添加尝试添加附件的相关代码,以供您参考。 请帮帮我。
foreach (ITestCaseResult result in results)
{
result.Attachments.Add(result.CreateAttachment(@"ThePath"));
result.Outcome = TestOutcome.Failed;
result.State = TestResultState.Completed;
result.Save();
}
results.Save(true);
testRun.Save();
testRun.Refresh();
这对我有用:
String path= @"path";
var store = tfsCollection.GetService<WorkItemStore>();
Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem wi = store.GetWorkItem(testCaseId);
wi.Attachments.Add(new Attachment(path));
wi.Save();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.