如何在詹金斯中获得XCTAttachments

时间:2018-09-26 12:54:08

标签: ios swift xcode jenkins fastlane

在UItests中,屏幕快照如下所示:

let screenshot = windows.firstMatch.screenshot()
let attachment = XCTAttachment(screenshot: screenshot)
attachment.lifetime = .keepAlways
attachment.name = named
sender.add(attachment)

他们像这样在报告中报名参加

report

我想做的是将屏幕快照显示为詹金斯工作中的工件。如何在jenkins中检索这些屏幕截图?

或者换句话说,这些附件位于光盘上的某个位置,还是我可以自动将它们保存在某个位置?

1 个答案:

答案 0 :(得分:1)

您可能需要在管道中运行archiveArtifacts步骤并拉入附件。完成后,它们将显示在詹金斯的工作机会视图中。我有类似于以下内容的管道代码。

dir('./build/DerivedData/Logs/Test/Attachments') {
    //Archive the screenshots 
    archiveArtifacts allowEmptyArchive: true, artifacts: '**/*.png'
    archiveArtifacts allowEmptyArchive: true, artifacts: '**/*.jpg'
}