0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Xcode16.3以降のxcresulttoolを使ってxcresultからビルド結果、テスト結果、コードカバレッジ (xccov) を取得する

Last updated at Posted at 2025-07-26

Xcode 11以降ではテストを実行するとテスト結果は.xcresultバンドルに出力されます。

xcresulttoolコマンドを使うことで.xcresultからビルドログ、テストレポート、コードカバレッジを取得することができますが、Xcode 16.3以降ではそれまでのxcresulttoolから引数と出力が変更されました。

Xcode 16.3以降のxcresulttoolコマンドでxcresultからビルドログ、テストレポートを表示する方法と、xccovコマンドでコードカバレッジを取得する方法をまとめます。

環境

確認した環境は以下の通りです。

  • Apple M3 macOS 15.5 Sequoia
  • Xcode 16.4 (16F6)
% xcrun xcresulttool --version 
xcresulttool version 23714, format version 3.53 (current)

xcresulttoolでビルド結果を取得する

xcresulttool get build-resultsでビルド結果を取得します。

ビルドのWarningやErrorはsourceURLにファイルパスがあり、#以降にStartingLineNumberとして行番号が含まれています。

% xcrun xcresulttool get build-results --path MyApp.xcresult
{
  "analyzerWarningCount" : 0,
  "analyzerWarnings" : [

  ],
  "destination" : {
    "architecture" : "arm64",
    "deviceId" : "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
    "deviceName" : "iPhone 16",
    "modelName" : "iPhone 16",
    "osBuildNumber" : "22E238",
    "osVersion" : "18.4",
    "platform" : "iOS Simulator"
  },
  "endTime" : 1753493800.749,
  "errorCount" : 0,
  "errors" : [

  ],
  "startTime" : 1753493742.393,
  "status" : "succeeded",
  "warningCount" : 10,
  "warnings" : [
    {
      "className" : "DVTTextDocumentLocation",
      "issueType" : "Uncategorized",
      "message" : "...",
      "sourceURL" : "file:///.../Foo.swift#EndingColumnNumber=4&EndingLineNumber=35&StartingColumnNumber=4&StartingLineNumber=35"
    },
    ...
  ]
}

xcresulttoolでテスト結果を取得する

xcresulttool get test-results summaryでテストサマリーを取得します。

テストサマリーには成功したテストは含まれませんが、失敗したテスト一覧(testFailures)が含まれています。

テストサマリーには失敗したテストのファイルパスや行番号は含まれていないようです。

% xcrun xcresulttool get test-results summary --path MyApp.xcresult
{
  "devicesAndConfigurations" : [
    {
      "device" : {
        "architecture" : "arm64",
        "deviceId" : "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
        "deviceName" : "iPhone 16",
        "modelName" : "iPhone 16",
        "osBuildNumber" : "22E238",
        "osVersion" : "18.4",
        "platform" : "iOS Simulator"
      },
      "expectedFailures" : 0,
      "failedTests" : 1,
      "passedTests" : 10,
      "skippedTests" : 0,
      "testPlanConfiguration" : {
        "configurationId" : "1",
        "configurationName" : "Test Scheme Action"
      }
    }
  ],
  "environmentDescription" : "MyApp · Built with macOS 15.5",
  "expectedFailures" : 0,
  "failedTests" : 1,
  "finishTime" : 1753493800.749,
  "passedTests" : 10,
  "result" : "Failed",
  "skippedTests" : 0,
  "startTime" : 1753493742.393,
  "statistics" : [

  ],
  "testFailures" : [
    {
      "failureText" : "Expectation failed: \"a\" == \"b\"",
      "targetName" : "MyAppTests",
      "testIdentifier" : 14,
      "testIdentifierString" : "FooTests/fooTest()",
      "testIdentifierURL" : "test://com.apple.xcode/MyApp/MyAppTests/FooTests/fooTest()",
      "testName" : "fooTest()"
    }
  ],
  "title" : "Test - MyApp",
  "topInsights" : [

  ],
  "totalTestCount" : 11
}

xcresulttool get test-results testsでテスト結果一覧を取得します。

失敗したテストはエラーメッセージが*.swift:{行番号}: からはじまっています。これにより失敗したテストのファイル名と行番号がわかるようです。

現時点では失敗したテストのファイルパスは取得できないようです。旧コマンドのxcrun xcresulttool get --legacy --format json --path MyApp.xcresultを実行するとfile:\/\/\/...\/MyTests.swift#EndingLineNumber=2&StartingLineNumber=1の形式で失敗したテストのファイルパスを取得できることは確認しました。どうしてもテストクラスのファイルパスを取得したい場合は旧コマンドを使用しましょう。

% xcrun xcresulttool get test-results tests --path MyApp.xcresult
{
  "devices" : [
    {
      "architecture" : "arm64",
      "deviceId" : "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
      "deviceName" : "iPhone 16",
      "modelName" : "iPhone 16",
      "osBuildNumber" : "22E238",
      "osVersion" : "18.4",
      "platform" : "iOS Simulator"
    }
  ],
  "testNodes" : [
    {
      "children" : [
        {
          "children" : [
            {
              "children" : [
                {
                  "name" : "barTest()",
                  "nodeIdentifier" : "FooTests/barTest()",
                  "nodeIdentifierURL" : "test://com.apple.xcode/MyApp/MyAppTests/FooTests/barTest()",
                  "nodeType" : "Test Case",
                  "result" : "Passed"
                },
                ...
                {
                  "children" : [
                    {
                      "name" : "FooTests.swift:29: Expectation failed: \"a\" == \"b\"",
                      "nodeType" : "Failure Message",
                      "result" : "Failed"
                    }
                  ],
                  "name" : "fooTest()",
                  "nodeIdentifier" : "FooTests/fooTest()",
                  "nodeIdentifierURL" : "test://com.apple.xcode/MyApp/MyAppTests/FooTests/fooTest()",
                  "nodeType" : "Test Case",
                  "result" : "Failed"
                },
              ],
              "name" : "FooTests",
              "nodeIdentifierURL" : "test://com.apple.xcode/MyApp/MyAppTests/FooTests",
              "nodeType" : "Test Suite",
              "result" : "Failed"
            }
          ],
          "name" : "MyAppTests",
          "nodeIdentifierURL" : "test://com.apple.xcode/MyApp/MyAppTests",
          "nodeType" : "Unit test bundle",
          "result" : "Failed"
        }
      ],
      "name" : "MyApp",
      "nodeType" : "Test Plan",
      "result" : "Failed"
    }
  ],
  "testPlanConfigurations" : [
    {
      "configurationId" : "1",
      "configurationName" : "Test Scheme Action"
    }
  ]
}

xcresulttool get test-results test-detailsで個別のテストケース詳細を取得します。

--test-idへはtest-results testsに表示されている"Test Case"ノードのnodeIdentifierまたはnodeIdentifierURLの値を指定します。

% xcrun xcresulttool get test-results test-details --test-id "FooTests/fooTest()" --path MyApp.xcresult

または

% xcrun xcresulttool get test-results test-details --test-id "test://com.apple.xcode/MyApp/MyAppTests/FooTests" --path MyApp.xcresult
{
  "devices" : [
    {
      "architecture" : "arm64",
      "deviceId" : "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
      "deviceName" : "iPhone 16",
      "modelName" : "iPhone 16",
      "osBuildNumber" : "22E238",
      "osVersion" : "18.4",
      "platform" : "iOS Simulator"
    }
  ],
  "duration" : "",
  "durationInSeconds" : 0,
  "hasMediaAttachments" : false,
  "hasPerformanceMetrics" : false,
  "testDescription" : "Test case with 1 run",
  "testIdentifier" : "FooTests/fooTest()",
  "testIdentifierURL" : "test://com.apple.xcode/MyApp/MyAppTests/FooTests",
  "testName" : "fooTest()",
  "testPlanConfigurations" : [
    {
      "configurationId" : "1",
      "configurationName" : "Test Scheme Action"
    }
  ],
  "testResult" : "Failed",
  "testRuns" : [
    {
      "children" : [
        {
          "children" : [
            {
              "children" : [
                {
                  "children" : [
                    {
                      "details" : "Swift.String",
                      "name" : "\"a\" : \"a\"",
                      "nodeType" : "Test Value"
                    },
                    {
                      "details" : "Swift.String",
                      "name" : "\"b\" : \"b\"",
                      "nodeType" : "Test Value"
                    }
                  ],
                  "name" : "Results",
                  "nodeType" : "Expression"
                },
                {
                  "name" : "FooTests.fooTest()",
                  "nodeType" : "Source Code Reference"
                }
              ],
              "name" : "Expectation failed: \"a\" == \"b\"",
              "nodeType" : "Test Case Run",
              "result" : "Failed"
            }
          ],
          "duration" : "0s",
          "durationInSeconds" : 0,
          "name" : "Test Scheme Action",
          "nodeIdentifier" : "1",
          "nodeType" : "Test Plan Configuration",
          "result" : "Failed"
        }
      ],
      "details" : "iOS Simulator 18.4",
      "duration" : "0s",
      "durationInSeconds" : 0,
      "name" : "iPhone 16",
      "deviceId" : "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
      "nodeType" : "Device",
      "result" : "Failed"
    }
  ]
}

xccovでコードカバレッジを取得する

現時点ではコードカバレッジはxcresulttoolでは取得できないようです。

xccov viewでコードカバレッジを取得します。

% xcrun xccov view --report --json MyApp.xcresult | jq .
{
  "coveredLines": 256,
  "executableLines": 4106,
  "lineCoverage": 0.06245586695561129,
  "targets": [
    {
      "buildProductPath": "/Users/.../Library/Developer/Xcode/DerivedData/MyApp-.../Build/Products/Debug-iphonesimulator/MyApp.app/MyApp",
      "coveredLines": 0,
      "executableLines": 212,
      "files": [
        {
          "coveredLines": 0,
          "executableLines": 10,
          "functions": [
            {
              "coveredLines": 0,
              "executableLines": 6,
              "executionCount": 0,
              "lineCoverage": 0,
              "lineNumber": 7,
              "name": "MyApp.body.getter"
            },
            {
              "coveredLines": 0,
              "executableLines": 4,
              "executionCount": 0,
              "lineCoverage": 0,
              "lineNumber": 8,
              "name": "closure #1 in MyApp.body.getter"
            }
          ],
          "lineCoverage": 0,
          "name": "MyApp.swift",
          "path": "/.../MyApp/MyApp.swift"
        },
        ...
      ],
      "lineCoverage": 0,
      "name": "MyApp.app"
    }
  ]
}

Appendix: xcresulttoolとxccovのhelp

xcresulttoolとxccovの各コマンドのhelpを載せておきます。

xcresulttool

xcresulttool --help

% xcrun xcresulttool --help
OVERVIEW: Xcode Result Bundle Tool (version 23714).

USAGE: xcresulttool <subcommand>

OPTIONS:
  --version               Show the version.
  -h, --help              Show help information.

SUBCOMMANDS:
  get                     Get Result Bundle contents.
  export                  Export Result Bundle contents.
  graph                   Print Result Bundle Object Graph. This subcommand is deprecated and will be removed in a future release, consider using `xcresulttool get test-report` instead.
  metadata                Result Bundle Metadata.
  formatDescription       Result Bundle Format Description. This subcommand is deprecated and will be removed in a future release.
  merge                   Merge Result Bundles.
  compare                 Compare one result bundle to another ("baseline") result bundle. Additional flags can be passed to limit the output to specific categories; if the flags are omitted the output will
                          contain all differences between the result bundles.

  See 'xcresulttool help <subcommand>' for detailed help.

xcresulttool get --help

% xcrun xcresulttool get --help
OVERVIEW: Get Result Bundle contents.

USAGE: xcresulttool get <subcommand>

OPTIONS:
  --version               Show the version.
  -h, --help              Show help information.

SUBCOMMANDS:
  object (default)        Get Result Bundle Object. This subcommand is deprecated and will be removed in a future release, consider using `xcresulttool get test-report` instead.
  test-results            Get a high level description of what was tested, the destinations on which tests ran, and other metadata along with all failures reported.
  build-results           Get a high level description of build action, the run destination for which the build was performed, and other metadata along with warnings and issues.
  log                     Get build, action, or console log from Result Bundle.
  content-availability    Get bundle content availability details, such as code coverage, build logs, or test results.

  See 'xcresulttool help get <subcommand>' for detailed help.

xcresulttool get test-results --help

% xcrun xcresulttool get test-results --help
OVERVIEW: Get a high level description of what was tested, the destinations on which tests ran, and other metadata along with all failures reported.

USAGE: xcresulttool get test-results <subcommand>

OPTIONS:
  --version               Show the version.
  -h, --help              Show help information.

SUBCOMMANDS:
  summary                 Get test report summary.
  tests                   Get all tests from test report.
  test-details            Get detailed information about the test.
  activities              Get the activity trees for the specified test. If the test has more than one run, the activity trees for each run will be included.
  insights                Get test report insights.
  metrics                 Get performance metrics.

  See 'xcresulttool help get test-results <subcommand>' for detailed help.

xcresulttool get test-results summary --help

% xcrun xcresulttool get test-results summary --help
OVERVIEW: Get test report summary.

Command output structure (JSON Schema):
{
    "schemas": {
        "Summary": {
            "type": "object",
            "properties": {
                "title": {
                    "type": "string"
                },
                "startTime": {
                    "type": "number",
                    "format": "double",
                    "description": "Date as a UNIX timestamp (seconds since midnight UTC on January 1, 1970)"
                },
                "finishTime": {
                    "type": "number",
                    "format": "double",
                    "description": "Date as a UNIX timestamp (seconds since midnight UTC on January 1, 1970)"
                },
                "environmentDescription": {
                    "type": "string",
                    "description": "Description of the Test Plan, OS, and environment that was used during testing"
                },
                "topInsights": {
                    "type": "array",
                    "items": {
                        "$ref": "#/schemas/InsightSummary"
                    }
                },
                "result": {
                    "$ref": "#/schemas/TestResult"
                },
                "totalTestCount": {
                    "type": "integer"
                },
                "passedTests": {
                    "type": "integer"
                },
                "failedTests": {
                    "type": "integer"
                },
                "skippedTests": {
                    "type": "integer"
                },
                "expectedFailures": {
                    "type": "integer"
                },
                "statistics": {
                    "type": "array",
                    "items": {
                        "$ref": "#/schemas/Statistic"
                    }
                },
                "devicesAndConfigurations": {
                    "$ref": "#/schemas/DeviceAndConfigurationSummary"
                },
                "testFailures": {
                    "$ref": "#/schemas/TestFailure"
                }
            },
            "required": [
                "title",
                "environmentDescription",
                "topInsights",
                "result",
                "totalTestCount",
                "passedTests",
                "failedTests",
                "skippedTests",
                "expectedFailures",
                "statistics",
                "devicesAndConfigurations",
                "testFailures"
            ],
        },
        "InsightSummary": {
            "type": "object",
            "properties": {
                "impact": {
                    "type": "string"
                },
                "category": {
                    "type" "string"
                },
                "text": {
                    "type" "string"
                }
            },
            "required": [
                "impact",
                "category",
                "text"
            ]
        },
        "TestResult": {
            "type": "string",
            "enum": [
                "Passed",
                "Failed",
                "Skipped",
                "Expected Failure",
                "unknown"
            ]
        },
        "Statistic": {
            "type": "object",
            "properties": {
                "title": {
                    "type": "string"
                },
                "subtitle": {
                    "type": "string"
                }
            },
            "required": [
                "title",
                "subtitle"
            ]
        },
        "DeviceAndConfigurationSummary": {
            "type": "object",
            "properties": {
                "device": {
                    "$ref": "#/schemas/Device"
                },
                "testPlanConfiguration": {
                    "$ref": "#/schemas/Configuration"
                },
                "passedTests": {
                    "type": "integer"
                },
                "failedTests": {
                    "type": "integer"
                },
                "skippedTests": {
                    "type": "integer"
                },
                "expectedFailures": {
                    "type": "integer"
                }
            },
            "required": [
                "device",
                "testPlanConfiguration",
                "passedTests",
                "failedTests",
                "skippedTests",
                "expectedFailures"
            ]
        },
        "Device": {
            "type": "object",
            "properties": {
                "deviceId": {
                    "type": "string"
                },
                "deviceName": {
                    "type": "string"
                },
                "architecture": {
                    "type": "string"
                },
                "modelName": {
                    "type": "string"
                },
                "platform": {
                    "type": "string"
                },
                "osVersion": {
                    "type": "string"
                },
                "osBuildNumber": {
                    "type": "string"
                }
            },
            "required": [
                "deviceId",
                "deviceName",
                "architecture",
                "modelName",
                "osVersion"
            ]
        },
        "Configuration": {
            "type": "object",
            "properties": {
                "configurationId": {
                    "type": "string"
                },
                "configurationName": {
                    "type": "string"
                }
            },
            "required": [
                "configurationId",
                "configurationName"
            ]
        },
        "TestFailure": {
            "type": "object",
            "properties": {
                "testName": {
                    "type": "string"
                },
                "targetName": {
                    "type": "string"
                },
                "failureText": {
                    "type": "string"
                },
                "testIdentifier": {
                    "type": "integer",
                    "format": "int64",
                    "description": "This field is deprecated. Please use testIdentifierString or testIdentifierURL.",
                    "deprecated": true
                },
                "testIdentifierString": {
                    "type": "string"
                },
                "testIdentifierURL": {
                    "type": "string"
                },
            },
            "required": [
                "testName",
                "targetName",
                "failureText",
                "testIdentifier",
                "testIdentifierString"
            ]
        }
    }
}

USAGE: xcresulttool get test-results summary --path <path> [--compact]

OPTIONS:
  --path <path>           The result bundle path.
  --compact               Output JSON in a compact format.
  --version               Show the version.
  -h, --help              Show help information.

xcresulttool get test-results tests --help

% xcrun xcresulttool get test-results tests --help
OVERVIEW: Get all tests from test report.

Command output structure (JSON Schema):
{
    "schemas": {
        "Tests": {
            "type": "object",
            "properties": {
                "testPlanConfigurations": {
                    "type": "array",
                    "items": {
                        "$ref": "#/schemas/Configuration"
                    }
                },
                "devices": {
                    "type": "array",
                    "items": {
                        "$ref": "#/schemas/Device"
                    }
                },
                "testNodes": {
                    "type": "array",
                    "items": {
                        "$ref": "#/schemas/TestNode"
                    }
                }
            },
            "required": [
                "testPlanConfigurations",
                "devices",
                "testNodes"
            ]
        },
        "Configuration": {
            "type": "object",
            "properties": {
                "configurationId": {
                    "type": "string"
                },
                "configurationName": {
                    "type": "string"
                }
            },
            "required": [
                "configurationId",
                "configurationName"
            ]
        },
        "Device": {
            "type": "object",
            "properties": {
                "deviceId": {
                    "type": "string"
                },
                "deviceName": {
                    "type": "string"
                },
                "architecture": {
                    "type": "string"
                },
                "modelName": {
                    "type": "string"
                },
                "platform": {
                    "type": "string"
                },
                "osVersion": {
                    "type": "string"
                },
                "osBuildNumber": {
                    "type": "string"
                }
            },
            "required": [
                "deviceId",
                "deviceName",
                "architecture",
                "modelName",
                "osVersion"
            ]
        },
        "TestNode": {
            "type": "object",
            "properties": {
                "nodeIdentifier": {
                    "type": "string"
                },
                "nodeType": {
                    "$ref": "#/schemas/TestNodeType"
                },
                "name": {
                    "type": "string"
                },
                "details": {
                    "type": "string"
                },
                "duration": {
                    "type": "string",
                    "description": "Human-readable duration with optional components of days, hours, minutes and seconds"
                },
                "durationInSeconds": {
                    "type": "number",
                    "format": "double",
                    "description": "Time interval in seconds"
                },
                "result": {
                    "$ref": "#/schemas/TestResult"
                },
                "tags": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "children": {
                    "type": "array",
                    "items": {
                        "$ref": "#/schemas/TestNode"
                    }
                }
            },
            "required": [
                "nodeType",
                "name"
            ]
        },
        "TestResult": {
            "type": "string",
            "enum": [
                "Passed",
                "Failed",
                "Skipped",
                "Expected Failure",
                "unknown"
            ]
        },
        "TestNodeType": {
            "type": "string",
            "enum": [
                "Test Plan",
                "Unit test bundle",
                "UI test bundle",
                "Test Suite",
                "Test Case",
                "Device",
                "Test Plan Configuration",
                "Arguments",
                "Repetition",
                "Test Case Run",
                "Failure Message",
                "Source Code Reference",
                "Attachment",
                "Expression",
                "Test Value"
            ]
        }
    }
}

USAGE: xcresulttool get test-results tests --path <path> [--compact]

OPTIONS:
  --path <path>           The result bundle path.
  --compact               Output JSON in a compact format.
  --version               Show the version.
  -h, --help              Show help information.

xcresulttool get test-results test-details --help

% xcrun xcresulttool get test-results test-details --help
OVERVIEW: Get detailed information about the test.

Command output structure (JSON Schema):
{
    "schemas": {
        "TestDetails": {
            "type": "object",
            "properties": {
                "testIdentifier": {
                    "type": "string"
                },
                "testIdentifierURL": {
                    "type": "string"
                },
                "testName": {
                    "type": "string"
                },
                "testDescription": {
                    "type": "string"
                },
                "duration": {
                    "type": "string",
                    "description": "Human-readable duration with optional components of days, hours, minutes and seconds"
                },
                "durationInSeconds": {
                    "type": "number",
                    "format": "double",
                    "description": "Time interval in seconds"
                },
                "startTime": {
                    "type": "number",
                    "format": "double",
                    "description": "Date as a UNIX timestamp (seconds since midnight UTC on January 1, 1970)"
                },
                "testPlanConfigurations": {
                    "type": "array",
                    "items": {
                        "$ref": "#/schemas/Configuration"
                    }
                },
                "devices": {
                    "type": "array",
                    "items": {
                        "$ref": "#/schemas/Device"
                    }
                },
                "arguments": {
                    "type": "array",
                    "items": {
                        "type": "object",
                        "properties": {
                            "value": {
                                "type": "string"
                            },
                        },
                        "required": [
                            "value"
                        ]
                    }
                },
                "testRuns": {
                    "type": "array",
                    "items": {
                        "$ref": "#/schemas/TestNode"
                    }
                },
                "testResult": {
                    "$ref": "#/schemas/TestResult"
                },
                "hasPerformanceMetrics": {
                    "type": "boolean"
                },
                "hasMediaAttachments": {
                    "type": "boolean"
                },
                "tags": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "bugs": {
                    "type": "array",
                    "items": {
                        "$ref": "#/schemas/Bug"
                    }
                },
                "functionName": {
                    "type": "string"
                }
            },
            "required": [
                "testIdentifier",
                "testName",
                "testDescription",
                "duration",
                "testPlanConfigurations",
                "devices",
                "testRuns",
                "testResult",
                "hasPerformanceMetrics",
                "hasMediaAttachments"
            ]
        },
        "Configuration": {
            "type": "object",
            "properties": {
                "configurationId": {
                    "type": "string"
                },
                "configurationName": {
                    "type": "string"
                }
            },
            "required": [
                "configurationId",
                "configurationName"
            ]
        },
        "Device": {
            "type": "object",
            "properties": {
                "deviceId": {
                    "type": "string"
                },
                "deviceName": {
                    "type": "string"
                },
                "architecture": {
                    "type": "string"
                },
                "modelName": {
                    "type": "string"
                },
                "platform": {
                    "type": "string"
                },
                "osVersion": {
                    "type": "string"
                },
                "osBuildNumber": {
                    "type": "string"
                }
            },
            "required": [
                "deviceId",
                "deviceName",
                "architecture",
                "modelName",
                "osVersion"
            ]
        },
        "TestNode": {
            "type": "object",
            "properties": {
                "nodeIdentifier": {
                    "type": "string"
                },
                "nodeType": {
                    "$ref": "#/schemas/TestNodeType"
                },
                "name": {
                    "type": "string"
                },
                "details": {
                    "type": "string"
                },
                "duration": {
                    "type": "string",
                    "description": "Human-readable duration with optional components of days, hours, minutes and seconds"
                },
                "durationInSeconds": {
                    "type": "number",
                    "format": "double",
                    "description": "Time interval in seconds"
                },
                "result": {
                    "$ref": "#/schemas/TestResult"
                },
                "tags": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                },
                "children": {
                    "type": "array",
                    "items": {
                        "$ref": "#/schemas/TestNode"
                    }
                }
            },
            "required": [
                "nodeType",
                "name"
            ]
        },
        "TestResult": {
            "type": "string",
            "enum": [
                "Passed",
                "Failed",
                "Skipped",
                "Expected Failure",
                "unknown"
            ]
        },
        "TestNodeType": {
            "type": "string",
            "enum": [
                "Test Plan",
                "Unit test bundle",
                "UI test bundle",
                "Test Suite",
                "Test Case",
                "Device",
                "Test Plan Configuration",
                "Arguments",
                "Repetition",
                "Test Case Run",
                "Failure Message",
                "Source Code Reference",
                "Attachment",
                "Expression",
                "Test Value"
            ]
        },
        "Bug": {
            "type": "object",
            "properties": {
                "url": {
                    "type": "string"
                },
                "identifier": {
                    "type": "string"
                },
                "title": {
                    "type": "string"
                }
            }
        }
    }
}

USAGE: xcresulttool get test-results test-details --test-id <test-id> --path <path> [--compact]

OPTIONS:
  --test-id <test-id>     Test identifier URL or identifier string.
  --path <path>           The result bundle path.
  --compact               Output JSON in a compact format.
  --version               Show the version.
  -h, --help              Show help information.

xcresulttool get build-results --help

% xcrun xcresulttool get build-results --help
OVERVIEW: Get a high level description of build action, the run destination for which the build was performed, and other metadata along with warnings and issues.

Command output structure (JSON Schema):
{
    "schemas": {
        "BuildResults": {
            "type": "object",
            "properties": {
                "actionTitle": {
                    "type": "string"
                },
                "destination": {
                    "$ref": "#/schemas/Device"
                },
                "startTime": {
                    "type": "number",
                    "format": "double",
                    "description": "Date as a UNIX timestamp (seconds since midnight UTC on January 1, 1970)"
                },
                "endTime": {
                    "type": "number",
                    "format": "double",
                    "description": "Date as a UNIX timestamp (seconds since midnight UTC on January 1, 1970)"
                },
                "status": {
                    "type": "string"
                },
                "analyzerWarningCount": {
                    "type": "integer"
                },
                "errorCount": {
                    "type": "integer"
                },
                "warningCount": {
                    "type": "integer"
                },
                "analyzerWarnings": {
                    "type": "array",
                    "items": {
                        "$ref": "#/schemas/Issue"
                    }
                },
                "warnings": {
                    "type": "array",
                    "items": {
                        "$ref": "#/schemas/Issue"
                    }
                },
                "errors": {
                    "type": "array",
                    "items": {
                        "$ref": "#/schemas/Issue"
                    }
                }
            },
            "required": [
                "destination",
                "startTime",
                "endTime",
                "analyzerWarnings",
                "warnings",
                "errors"
            ]
        },
        "Device": {
            "type": "object",
            "properties": {
                "deviceId": {
                    "type": "string"
                },
                "deviceName": {
                    "type": "string"
                },
                "architecture": {
                    "type": "string"
                },
                "modelName": {
                    "type": "string"
                },
                "platform": {
                    "type": "string"
                },
                "osVersion": {
                    "type": "string"
                },
                "osBuildNumber": {
                    "type": "string"
                }
            },
            "required": [
                "deviceId",
                "deviceName",
                "architecture",
                "modelName",
                "osVersion"
            ]
        },
        "Issue": {
            "type": "object",
            "properties": {
                "issueType": {
                    "type": "string"
                },
                "message": {
                    "type": "string"
                },
                "targetName": {
                    "type": "string"
                },
                "sourceURL": {
                    "type": "string"
                },
                "className": {
                    "type": "string"
                },
            },
            "required": [
                "issueType",
                "message"
            ]
        }
    }
}

USAGE: xcresulttool get build-results --path <path> [--compact]

OPTIONS:
  --path <path>           The result bundle path.
  --compact               Output JSON in a compact format.
  --version               Show the version.
  -h, --help              Show help information.

xccov

xccov help

% xcrun xccov help
xccov diff --json [--path-equivalence <from,to>] before.xccovreport after.xccovreport

xccov diff --json [--path-equivalence <from,to>] before.xcresult after.xcresult

xccov help [view | diff | merge]

xccov merge [--outReport] [--outArchive] report1.xccovreport archive1.xccovarchive report2.xccovreport archive2.xccovarchive ...

xccov view [--file-list | --file <path>] [--json] archive.xccovarchive

xccov view --archive [--file-list | --file <path> [--json] | --json] result_bundle.xcresult

xccov view [--only-targets | --files-for-target <target name> | --functions-for-file <name or path>] [--json] report.xccovreport

xccov view --report [--only-targets | --files-for-target <target name> | --functions-for-file <name or path>] [--json] result_bundle.xcresult

xccov is a command line utility that can generate Xcode coverage data. For detailed information regarding a particular command, try help <command>.
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?