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