我已經想出瞭如何將附件添加到TestCase,Defect對象,但是我不能使用相同的機制,將測試結果文件附加到一個TestCaseResult對象。我收到「驗證錯誤:Attachment.attachments [0]不應爲空」的錯誤消息。我在創建測試結果的過程中嘗試過附加,並且更新了以前創建的現有測試結果。如果不支持將測試結果文件附加到TestCaseResult,我會感到驚訝,因爲這是常見的主流行爲。謝謝。Rally SOAP API - 如何將附件添加到TestCaseResult
我的代碼:
私人附件createAttachment(串resultsFile) { 字節[]字節= readFileAsByteArray(resultsFile);
// Create attachment content;
AttachmentContent attachmentContent = new AttachmentContent();
attachmentContent.Content = bytes;
attachmentContent.Workspace = this.m_targetWorkspace;
CreateResult result = m_rallyService.create(attachmentContent);
attachmentContent = (AttachmentContent)result.Object;
//attachmentContent = (AttachmentContent)this.m_rallyService.read(attachmentContent, this.m_targetWorkspace);
Attachment attachment = new Attachment();
attachment.ContentType = "application/vnd.openxmlformats - officedocument.wordprocessingml.document";
attachment.Content = attachmentContent;
attachment.Name = "Bubba.docx";
attachment.Size = bytes.Length;
attachment.SizeSpecified = true;
attachment.User = this.m_rallyUser;
//attachment.Artifact = testResult;
attachment.Workspace = this.m_targetWorkspace;
result = m_rallyService.create(attachment);
attachment = (Attachment)result.Object;
//attachment = (Attachment)this.m_rallyService.read(attachment, this.m_targetWorkspace);
return attachment;
}
TestCaseResults不是工件,它們是WorkspaceDomainObjects。所以你必須使用TestCaseResult屬性。 – 2012-07-10 17:13:57