在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'
}