2025 年 3 月 27 日より、AOSP のビルドとコントリビューションには aosp-main
ではなく android-latest-release
を使用することをおすすめします。詳細については、AOSP の変更をご覧ください。
既存の APK からインストルメンテーション テストを実行する
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
この手順では、Trade Federation パッケージがローカルで利用可能であることを前提としています。そうでない場合は、ダウンロードの手順に従って入手してください。
次に、下記のコマンドを使用してインストゥルメンテーション テストの APK をインストールし、テストを実行して、実行中のテストを表示します。
./tradefed.sh run instrumentations --apk-path <path of your apk>
出力は次のようになります。
07-17 10:55:32 D/InvocationToJUnitResultForwarder: Starting test: android.animation.cts.ValueAnimatorTest#testOfArgb
07-17 10:55:33 D/InvocationToJUnitResultForwarder: Starting test: android.animation.cts.ValueAnimatorTest#testIsRunning
07-17 10:55:34 D/InvocationToJUnitResultForwarder: Starting test: android.animation.cts.ValueAnimatorTest#testGetCurrentPlayTime
07-17 10:55:35 D/InvocationToJUnitResultForwarder: Starting test: android.animation.cts.ValueAnimatorTest#testStartDelay
07-17 10:55:35 I/InvocationToJUnitResultForwarder: Run ended in 2m 20s
オプションで --serial <device serial number>
を指定すると、特定のデバイスに対して実行できます。デバイスのシリアル番号は、adb devices
を使用して取得できます。
Tradefed の実行の詳細については、Tradefed によるテストのセクションをご覧ください。
このページのコンテンツやコードサンプルは、コンテンツ ライセンスに記載のライセンスに従います。Java および OpenJDK は Oracle および関連会社の商標または登録商標です。
最終更新日 2025-03-26 UTC。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["必要な情報がない","missingTheInformationINeed","thumb-down"],["複雑すぎる / 手順が多すぎる","tooComplicatedTooManySteps","thumb-down"],["最新ではない","outOfDate","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["サンプル / コードに問題がある","samplesCodeIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-03-26 UTC。"],[],[],null,["# Run instrumentation tests from existing APKs\n\nThese instructions assume you have the Trade Federation package available\nlocally; if not,\n[follow the download instructions](/docs/core/tests/tradefed/fundamentals/machine_setup#download-tradefed)\nto obtain it.\n\nThen use the following command to install the APK of instrumentation tests,\nexecute the tests, and display the tests that are running: \n\n ./tradefed.sh run instrumentations --apk-path \u003cpath of your apk\u003e\n\nWith output resembling: \n\n 07-17 10:55:32 D/InvocationToJUnitResultForwarder: Starting test: android.animation.cts.ValueAnimatorTest#testOfArgb\n 07-17 10:55:33 D/InvocationToJUnitResultForwarder: Starting test: android.animation.cts.ValueAnimatorTest#testIsRunning\n 07-17 10:55:34 D/InvocationToJUnitResultForwarder: Starting test: android.animation.cts.ValueAnimatorTest#testGetCurrentPlayTime\n 07-17 10:55:35 D/InvocationToJUnitResultForwarder: Starting test: android.animation.cts.ValueAnimatorTest#testStartDelay\n 07-17 10:55:35 I/InvocationToJUnitResultForwarder: Run ended in 2m 20s\n\nYou can optionally specify `--serial \u003cdevice serial number\u003e` to run\nagainst a given device. The serial number of your device can be obtained\nusing `adb devices`.\n\nSee the\n[Testing through Tradefed section](/docs/core/tests/tradefed/testing/through-tf)\nfor more details about Tradefed executions."]]