[英]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.