【问题标题】:How to access Bitrise iOS test results from Swift DangerFile?如何从 Swift DangerFile 访问 Bitrise iOS 测试结果?
【发布时间】:2022-10-23 18:00:08
【问题描述】:

我正在尝试实现danger-swift,但我不知道在哪里可以访问测试结果并从Bitrise 标记失败的结果。

我正在使用一个名为 DangerXCodeSummary 的危险 swift 插件,但我不知道 Bitrise 在哪里存储来自 xcode-test@2 的测试结果。

危险文件:

import Danger
import DangerXCodeSummary
import Foundation

let danger = Danger()

let testReportPath = "??" // What's the path for the test results?
XCodeSummary(filePath: testReportPath).report()

比特升脚本:

...
UnitTests:
before_run:
- _ensure_dependencies
after_run:
- _add_build_result_to_pr
steps:
- xcode-test@2: {} # What's the file path for the test results?
- deploy-to-bitrise-io@1: {}
envs:
-   ots:
    is_expand: false
    BITRISE_PROJECT_PATH: MyApp.xcodeproj
- opts:
    is_expand: false
    BITRISE_SCHEME: AppTests
    description: Unit Tests running at every commit.
...

_add_build_result_to_pr:
steps:
- script@1:
    title: Commenting on the PR
    is_always_run: true
    inputs:
    - content: |-
        #!/usr/bin/env bash
        # fail if any commands fails
        set -e
        echo "################### DANGER ######################"
        echo "Install Danger"
        brew install danger/tap/danger-swift
        echo "Run danger"
        danger-swift ci
        echo "#################################################"

【问题讨论】:

    标签: swift xcode continuous-integration bitrise danger


    【解决方案1】:

    您可以在 Workflow Editor UI 上查看该步骤生成的输出,或者在 step.yml 的 Step 存储库中查看。对于 Xcode 测试步骤:https://github.com/bitrise-steplib/steps-xcode-test/blob/deb39d7e9e055a22f33550ed3110fb3c71beeb79/step.yml#L287

    您正在寻找 xcresult 测试输出,我说得对吗?如果是,您可以从BITRISE_XCRESULT_PATH 环境变量(https://github.com/bitrise-steplib/steps-xcode-test/blob/deb39d7e9e055a22f33550ed3110fb3c71beeb79/step.yml#L296)中读取它,它是 Xcode 测试的输出(一旦 Xcode 测试完成,它会将这个环境变量设置为xcresult 的路径)。请记住,这是.xcresult 格式(官方Xcode 测试结果格式)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-08-21
      • 1970-01-01
      • 2018-05-08
      • 1970-01-01
      • 2017-04-19
      相关资源
      最近更新 更多