如何在 jenkins 中获取 XCTAttachments
How to get XCTAttachments in jenkins
在 UItests 中,屏幕截图附加到 XCTest 报告中,如下所示:
let screenshot = windows.firstMatch.screenshot()
let attachment = XCTAttachment(screenshot: screenshot)
attachment.lifetime = .keepAlways
attachment.name = named
sender.add(attachment)
他们在报告中是这样的:
我想做的是在 jenkins 作业中将屏幕截图显示为工件。我如何在 jenkins 中检索这些屏幕截图?
或者换句话说,这些附件是否位于光盘上的某处,或者我可以自动将它们保存在某处吗?
您可能需要 运行 管道中的 archiveArtifacts 步骤并拉入附件。完成后,它们将显示在 Jenkins 的作业构建视图中。为此,我有类似于以下的管道代码。
dir('./build/DerivedData/Logs/Test/Attachments') {
//Archive the screenshots
archiveArtifacts allowEmptyArchive: true, artifacts: '**/*.png'
archiveArtifacts allowEmptyArchive: true, artifacts: '**/*.jpg'
}
在 UItests 中,屏幕截图附加到 XCTest 报告中,如下所示:
let screenshot = windows.firstMatch.screenshot()
let attachment = XCTAttachment(screenshot: screenshot)
attachment.lifetime = .keepAlways
attachment.name = named
sender.add(attachment)
他们在报告中是这样的:
我想做的是在 jenkins 作业中将屏幕截图显示为工件。我如何在 jenkins 中检索这些屏幕截图?
或者换句话说,这些附件是否位于光盘上的某处,或者我可以自动将它们保存在某处吗?
您可能需要 运行 管道中的 archiveArtifacts 步骤并拉入附件。完成后,它们将显示在 Jenkins 的作业构建视图中。为此,我有类似于以下的管道代码。
dir('./build/DerivedData/Logs/Test/Attachments') {
//Archive the screenshots
archiveArtifacts allowEmptyArchive: true, artifacts: '**/*.png'
archiveArtifacts allowEmptyArchive: true, artifacts: '**/*.jpg'
}