デベロッパー デバイス プラットフォームのテスト結果を確認する

このガイドでは、Developer Device Platformのデバイスランガイドに沿って トリガーされたテストと実行可能ファイルの結果を確認する方法について説明します。

始める前に

以下の手順では、 Google Cloud プロジェクトを作成済みで、 Developer Device Platform の クイックスタート ガイドの手順を完了し、ターミナルで gcloud を使用して認証していることを前提としています。

コマンドラインから

次のコマンドとセッション ID を使用して、テストまたは実行可能ファイルの結果の基本的な概要を確認します。

gcloud beta device-run sessions describe SESSION_ID

次のような結果が返されます。

Session SESSION_ID finished with result [FAILED].
Result files are stored at [https://console.cloud.google.com/storage/browser/BUCKET_NAME/automation/sessions/SESSION_ID/].
JOB NAME  EXECUTION NAME  EXECUTION RESULT
job-000   all             FAILED: 2 test cases failed, 5 passed
job-001   all             PASS

--device フラグで指定したデバイスタイプ ID ごとに、セッションで 1 つのジョブが生成されます。ジョブ インデックスは、デバイス ID の順序に従います。テストの失敗は想定されるものであり、反復的な改善と実行を通じて調査して解決する必要があります。

セッションの詳細情報を取得するには、次のように、前に実行した describe コマンドに --full を追加します。

gcloud beta device-run sessions describe SESSION_ID --full

次のような結果が返されます。

Android インストルメンテーション

name: projects/PROJECT_ID/locations/global/sessions/session-370961e1
sessionConfig:
  displayName: instrumentation-session
  jobConfigs:

    -   action:
      androidInstrumentationTest:
        testInstallable:
          files:
        -   gcsInputFile:
              path: gs://BUCKET_NAME/automation/inputs/2026-07-30_11:28.31915956_8514/app_name_test.apk
    allocationConfig:
      deviceConfigs:
    -   actions:
        -   androidInstallPackages:
            installables:
            -   files:
                -   gcsInputFile:
                  path: gs://BUCKET_NAME/automation/inputs/2026-07-30_11:28.31915956_8514/app_name.apk
        -   androidLogcat: {}
        requirement:
          deviceId: pa3q-35
    displayName: job-000
  outputDirectoryConfig:
    gcsOutputDirectory:
      path: gs://BUCKET_NAME/automation/sessions
sessionReport:
  endTime: '2026-07-30T03:30:05.838Z'
  id: 6587313f-fdf7-418a-a9b9-b6fa98dff838
  jobReports:
    -   displayName: job-000
    endTime: '2026-07-30T03:30:04.601Z'
    executionReports:
        -   displayName: all
      endTime: '2026-07-30T03:30:02.151Z'
      id: 29b167dd-dde9-4ea9-b2cd-738049083fc9
      outputFiles:
            -   gcsOutputFile:
          path: gs://PROJECT_ID-devicerun/automation/sessions/session-370961e1/job-000/execution-000/logcat.txt
            -   gcsOutputFile:
          path: gs://PROJECT_ID-devicerun/automation/sessions/session-370961e1/job-000/execution-000/instrument.log
            -   gcsOutputFile:
          path: gs://PROJECT_ID-devicerun/automation/sessions/session-370961e1/job-000/execution-000/junit.xml
      result:
        cause:
          summary:
            message: One or more test assertions or test methods failed. Inspect the
              test runner logs and structured test results for details.
            reason: TEST_CASE_FAILURE
            type: CUSTOMER
        resultType: FAILED
      startTime: '2026-07-30T03:29:32.769Z'
      status:
        progressMessages:
                -   2 test cases failed, 5 passed
        statusType: DONE
    id: 7974e37a-2928-4aaf-abba-3a8b6bae853b
    result:
      cause:
        summary:
          message: Job has one or more failed tests. See execution reports for details.
          reason: JOB_HAS_FAILED_TESTS
      resultType: FAILED
    startTime: '2026-07-30T03:28:53.756Z'
    status:
      statusType: DONE
  result:
    cause:
      summary:
        message: Session has one or more failed jobs. See job reports for details.
        reason: SESSION_HAS_FAILED_JOBS
    resultType: FAILED
  startTime: '2026-07-30T03:28:52.702Z'
  status:
    statusType: DONE

Android 実行可能ファイル

name: projects/PROJECT_ID/locations/global/sessions/session-8a41c2b0
sessionConfig:
  displayName: android-executable-session
  jobConfigs:

    -   action:
      androidNativeBinary:
        androidNativeBinary:
          gcsInputFile:
            path: gs://BUCKET_NAME/automation/inputs/2026-07-30_11:28.31915956_8514/my_executable
        args:
        -   --example_flag=/data/local/tmp/example_value
        -   --threads=4
    allocationConfig:
      deviceConfigs:
    -   actions:
        -   androidLogcat: {}
        -   androidPushFiles:
            fileConfigs:
            -   destinationPath: /data/local/tmp/model.tflite
                sourceFile:
                  gcsInputFile:
                    path: gs://BUCKET_NAME/automation/inputs/2026-07-30_11:28.31915956_8514/model.tflite
        requirement:
          deviceId: shiba-34
    displayName: job-000
  outputDirectoryConfig:
    gcsOutputDirectory:
      path: gs://BUCKET_NAME/automation/sessions
sessionReport:
  endTime: '2026-07-30T03:30:05.838Z'
  id: 4b9120ec-fdf7-418a-a9b9-b6fa98dff838
  jobReports:
    -   displayName: job-000
    endTime: '2026-07-30T03:30:04.601Z'
    executionReports:
        -   displayName: execution-000
      endTime: '2026-07-30T03:30:02.151Z'
      id: 19a267dd-dde9-4ea9-b2cd-738049083fc9
      outputFiles:
            -   gcsOutputFile:
          path: gs://PROJECT_ID-devicerun/automation/sessions/session-8a41c2b0/job-000/execution-000/logcat.txt
            -   gcsOutputFile:
          path: gs://PROJECT_ID-devicerun/automation/sessions/session-8a41c2b0/job-000/execution-000/output.log
      result:
        resultType: PASSED
      startTime: '2026-07-30T03:29:32.769Z'
      status:
        statusType: DONE
    id: 8874e37a-2928-4aaf-abba-3a8b6bae853b
    result:
      resultType: PASSED
    startTime: '2026-07-30T03:28:53.756Z'
    status:
      statusType: DONE
  result:
    resultType: PASSED
  startTime: '2026-07-30T03:28:52.702Z'
  status:
    statusType: DONE

iOS XCTest

すべてのフラグ が有効になっているライブ iOS XCTest 実行からの gcloud beta device-run sessions describe SESSION_ID --full の実際のサニタイズされた出力は次のとおりです。

name: projects/PROJECT_ID/locations/global/sessions/session-4b941167-5629-4abb-a8a1-a9814bf16847
sessionConfig:
  displayName: xctest-session
  jobConfigs:

    -   action:
      iosXcTest:
        testsZip:
          gcsInputFile:
            path: gs://BUCKET_NAME/automation/inputs/2026-10-09_11:33.01234567_ABCD/MyTests.zip
    allocationConfig:
      deviceConfigs:
        -   actions:
            -   iosInstallPackages:
            ipas:
                -   gcsInputFile:
                path: gs://BUCKET_NAME/automation/inputs/2026-10-09_11:33.01234567_ABCD/AdditionalApp.ipa
        requirement:
          deviceId: iphonese3-18-4
    displayName: job-000
  outputDirectoryConfig:
    gcsOutputDirectory:
      path: gs://BUCKET_NAME/automation/sessions

この出力で、テスト対象アプリのプルされたファイルが .../artifacts/output.txt(com.example.app/Documents/なし)にあることを確認します。

ウェブブラウザの場合

詳細については、テスト出力からテスト結果を含むバケットの URL を読み込みます。これは https://console.cloud.google.com/storage/browser/BUCKET_NAME/automation/sessions/SESSION_ID/ のようになります。

セッションは、ストレージで次のパス形式で表示されます。 gs://BUCKET_NAME/automation/sessions/SESSION_ID/job-000/EXECUTION_ID/

コンソールの Google Cloud ウェブ インターフェースでログを参照する手順は次のとおりです。

  1. ブラウザで、gcloud config set project コマンドで使用したプロジェクト名を URL https://console.cloud.google.com/?project= に追加して、ページを読み込みます。
  2. 左上のメニューを開きます。
  3. [Cloud Storage ] を探します。
  4. ストレージ メニューから [バケット] を選択します。
  5. 最初の列で、プロジェクトの名前をクリックします。
  6. [自動化] をクリックします。
  7. [セッション] をクリックします。
  8. [フィルタ ] フィールドに、最新のテスト実行のセッション ID を貼り付けます(テスト出力をご覧ください)。
  9. 表示されたセッション名をクリックします。
  10. job-*] を選択して、junit.xml(Android インストルメンテーションと iOS XCTest の実行用)を表示します。これには、ジョブ内のすべての実行と テストケースにわたる統合された結果の詳細が含まれています。
  11. [execution-]*(またはフレーキー テストの再試行が --flaky-test-attempts で構成されている場合は [execution-*-rerun-]*)を開いて、各個別の実行またはシャードの内訳を確認します。セッションの種類と構成されたフラグに応じて、このフォルダには多数のアーティファクトが含まれる場合があります。詳細については、結果を把握する をご覧ください。
  12. 公開 URL と認証 URL にアクセスして、結果を確認します。

ファイル構造

Cloud Storage バケット内のログファイルを確認して、セッションの実行の詳細を把握します。ファイル構造は次のようになります。

Android インストルメンテーション


-   gs://BUCKET_NAME/automation
    -   inputs/
        -   2026-05-29_10:13.026220_JZTM
            -   app.apk
            -   test.apk
    -   sessions/
        -   SESSION_ID
            -   job-000/
                -   junit.xml
                -   execution-000/
                    -   artifacts/
                        -   sdcard/
                            -   output.txt
                    -   bugreport.zip
                    -   dumpsys.txt
                    -   instrument.log
                    -   junit.xml
                    -   logcat.txt
                    -   video.mp4
                -   execution-001/
                    -   instrument.log
                    -   junit.xml
                    -   logcat.txt
                    -   video.mp4
            -   job-001/
        -   SESSION_ID

Android 実行可能ファイル


-   gs://BUCKET_NAME/automation
    -   inputs/
        -   2026-05-29_10:13.026220_JZTM
            -   my_executable
            -   model.tflite
    -   sessions/
        -   SESSION_ID
            -   job-000/
                -   execution-000/
                    -   artifacts/
                        -   data/
                            -   local/
                                -   tmp/
                                    -   results.json
                    -   bugreport.zip
                    -   dumpsys.txt
                    -   logcat.txt
                    -   output.log
                    -   video.mp4
            -   job-001/
        -   SESSION_ID

iOS XCTest


-   gs://BUCKET_NAME/
    -   automation/
        -   inputs/
            -   2026-10-09_11:33.01234567_ABCD/
                -   AdditionalApp.ipa
                -   MyTests.zip
                -   data.txt
        -   sessions/
            -   SESSION_ID/
                -   job-000/
                    -   execution-000/
                        -   artifacts/
                            -   output.txt
                        -   junit.xml
                        -   system.log

この出力で、artifacts/ のプルされたパスを確認します。 --paths-to-pull=com.example.app:/Documents/output.txt の場合、テスト対象アプリ(AUT)からプルすると、サービスは /Documents を削除し、ファイルを artifacts/output.txt( artifacts/com.example.app/Documents/output.txt ではない)に直接配置します。追加の アプリ(--additional-apps)からプルすると、 artifacts/<bundle_id>-genfiles/output.txt に配置されます。

結果を把握する

Android インストルメンテーションと iOS XCTest の実行の場合、出力で生成される junit.xml ファイルは標準の JUnit XML ファイルです。実行レベルの junit.xml は各 execution-* ディレクトリに書き込まれ、統合された junit.xml は各 job-* ディレクトリに書き込まれます。これらのファイルにはテストメソッドごとの結果が含まれているため、個々のテストメソッドの合格または不合格のステータス、実行時間、エラー トレースを確認できます。これらのファイルは、ほとんどの継続的インテグレーションと継続的デリバリー(CI/CD)システムおよびテスト レポート ツールと簡単に統合して解析できます。

構造化されたテスト結果に加えて、各 execution-* ディレクトリにはプラットフォーム固有のログとアーティファクトが含まれています。

  • Android インストルメンテーションの実行 には、未加工のインストルメンテーション ランナー出力用の instrument.log と、デバイス全体の Android システムログ用の logcat.txt が含まれます。--bugreport、--dumpsys、--video で有効にすると、実行ディレクトリには bugreport.zip、dumpsys.txt、画面動画の録画も含まれます。
  • Android 実行可能ファイルの実行 には、実行可能ファイルによって書き込まれた 標準出力(stdout)と標準エラー(stderr)をキャプチャするoutput.log と、デバイス全体の Android システムログをキャプチャするlogcat.txt (すべての Android ジョブでデフォルトで収集)が含まれます。また、オプションの--bugreport、--dumpsys、または --video アーティファクトも含まれます。
  • iOS XCTest の実行 には、未加工の iOS デバイスの syslog をキャプチャする system.log(すべての iOS XCTest ジョブでデフォルトで収集)と、テスト実行中にプロセスがクラッシュした場合の .ips 診断クラッシュ レポートが含まれます。
  • --paths-to-pull で指定されたプルされたデバイスファイル は、実行ディレクトリの artifacts/ サブフォルダに保存されます。
    • Android の実行の場合、プルされたファイルは artifacts/ のデバイスパスを保持します(例: artifacts/sdcard/output.txt、 artifacts/data/local/tmp/results.json)。
    • iOS XCTest の実行の場合、--paths-to-pull=BUNDLE_ID:DEVICE_PATH を使用してアプリデータ コンテナからプルされたファイルは、artifacts/ のバンドル ID ごとに整理されます。
      • com.example.app がテスト対象アプリの場合、artifacts/output.txt に直接保存されます。
      • com.example.app が追加のアプリ(--additional-apps)の場合、 artifacts/com.example.app-genfiles/output.txt に保存されます。

補足資料

次のステップ

次は、デベロッパー デバイス プラットフォーム デバイス ストリーミング APIをお試しください。