【问题标题】:How to attach screen shot to XCUITest report in Jenkins. Can only see screenshot if running through XCODE如何在 Jenkins 中将屏幕截图附加到 XCUITest 报告。只有通过 XCODE 运行才能看到截图
【发布时间】:2016-08-25 18:01:49
【问题描述】:

如何在 Jenkins 中将屏幕截图附加到 XCUITest 报告。只有通过 XCODE 运行才能看到截图

步骤

  1. 我在 Jenkins 有一份工作,负责构建和运行 XCUITest
  2. 但是完成后没有选项可以看到失败案例的截图
  3. 我使用xcpretty 生成HTML 类型的报告,但也有截图不显示。 它有一个 -screenshot 属性,但只接受具有指定名称的屏幕截图。 (如TestcaseName_Classname.jpg) 但是 xcuitest 使用名称'screenshot_.jpg"

    截取屏幕截图

    任何人都可以提供一些关于此的信息

谢谢

【问题讨论】:

    标签: xctest


    【解决方案1】:

    到目前为止,xcpretty 中的屏幕截图集合已损坏。

    https://github.com/supermarin/xcpretty/issues/251

    您可以使用 xcsummary 作为解决方法。

    https://github.com/supermarin/xcpretty/issues/251

    【讨论】:

      【解决方案2】:

      你需要在这里指向attachment.name

      func takeScreenshot() {
              let screenshot = XCUIScreen.main.screenshot()
              let attachment = XCTAttachment(screenshot: screenshot)
              attachment.lifetime = .deleteOnSuccess
              attachment.name = UITest.sharedInstance.testCase.name
              add(attachment)
          }
      

      【讨论】:

        猜你喜欢
        • 2019-08-16
        • 2021-10-15
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多