2025 年 3 月 27 日より、AOSP のビルドとコントリビューションには aosp-main
ではなく android-latest-release
を使用することをおすすめします。詳細については、AOSP の変更をご覧ください。
Tradefed でのテスト
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
Tradefed でのテストはテストランナーによって実行されます。テストランナーでは必要なテスト手順のために Android デバイスを制御できます。以下の手順を順番に行ってください。
1. 新しいテストランナーを作成する
ここでは、新しい Tradefed テストランナーを作成する基本について説明します。
これは、まったく新しいタイプのテストをサポートし、新しいランナーを最初から開発する必要がある場合に特に便利です。
手順については、Tradefed テストランナーを作成するをご覧ください。
2. シャード可能なテストランナーを作成する
テストランナーをシャード可能にする方法についても説明します。シャード可能なテストランナーにより、インフラストラクチャがテスト実行全体を複数のデバイスに(コロケートされているかどうかに関係なく)分散できます。これは、テストのコーパスが大きく、実行を並列化して短時間で完了させる場合に便利です。
手順については、シャードされた IRemoteTest テストランナーを作成するをご覧ください。
3.ホストドリブン テストを作成する
ホストドリブン テストは一般的なユースケースで、テスト実行がホスト側から行われ、テストの必要に応じてデバイスがクエリされます。これは、デバイスの再起動など、テストで必要なデバイス操作がデバイスの状態自体に影響を与える場合に便利です。
テストランナー タイプは Tradefed 内で使用できます。また、スイートを介して実行する場合にも使用できます。
手順については、Trade Federation でホストドリブン テストを作成するをご覧ください。
4. テストの指標をレポートする
テストでは、実行結果に加えて指標もレポートするのが一般的です。テストランナーに応じて、指標をレポートする方法がいくつかあります。
例については、Tradefed テストの指標またはデータを報告するをご覧ください。
5. ログの自動収集
一部のログは、問題のデバッグでよく使用されます(例: Logcat)。そのため Tradefed には、ログを簡単に収集する自動メカニズムがあります。
使用方法については、障害発生時のログの自動収集をご覧ください。
6. テストの自動再試行
Tradefed を有効にすると、エラーを自動的に再試行したり、いくつかのテストを何度も反復して実行することができます。
詳しくは、テストの自動再試行をご覧ください。
7. 再試行の分離
Tradefed では、再試行と再試行の間にテスト実行の分離を試みることができます。
詳しくは、再試行の分離をご覧ください。
8. シェルテストの作成
詳しくは、Trade Federation でシェルテストを作成するをご覧ください。
詳しくは、Trade Federation のグローバル フィルタをご覧ください。
このページのコンテンツやコードサンプルは、コンテンツ ライセンスに記載のライセンスに従います。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,["# Test through Tradefed\n\nExecution of tests in Tradefed is conducted by *test runners* that allow the\ncontrol of Android *devices* for necessary testing steps. Follow these sections in order.\n\n1. Write a new test runner\n--------------------------\n\nHere you will learn the basics that go into writing a new Tradefed test runner.\nThis is particularly useful if you plan to support a brand new type of test, and\nyou need a new runner to be developed from scratch.\n\nSee [Write a Tradefed test runner](/docs/core/tests/tradefed/testing/through-tf/new-test-runner) for instructions.\n\n2. Write a shardable test runner\n--------------------------------\n\nYou may also learn how to make your test runner shardable. A shardable test\nrunner allows the infrastructure to distribute the full test execution over\nseveral devices (collocated or not). This is useful when the corpus of\ntests is large, and you want to parallelize the execution and speed completion.\n\nSee [Write a sharded IRemoteTest test runner](/docs/core/tests/tradefed/testing/through-tf/sharded-runner) for\nsteps.\n\n3. Write a host-driven test\n---------------------------\n\nHost-driven tests are a common use case where test execution is driven from\nthe host-side and queries the device as needed for the test. This is useful when\ndevice operation required by the test affects the device state itself, for\nexample rebooting the device.\n\nThe test runner type can be used within Tradefed or when running through a\nsuite.\n\nSee [Write a host-driven test in Trade Federation](/docs/core/tests/tradefed/testing/through-tf/host-driven-test) for\ninstructions.\n\n4. Report metrics from tests\n----------------------------\n\nIt's fairly common for a test to report metrics in addition to the execution\nresults. Depending on the test runner, there are several methods to report the\nmetrics.\n\nSee [Report metrics or data from a Tradefed test](/docs/core/tests/tradefed/testing/through-tf/report-metrics) for examples.\n\n5. Automated log collection\n---------------------------\n\nSome logs are commonly used for debugging issues, for example: Logcat. So\nTradefed offers an automated mechanism to collect them easily.\n\nSee [Automated log on failure collection](/docs/core/tests/tradefed/testing/through-tf/log-on-failure) for use.\n\n6. Automatic test retry\n-----------------------\n\nYou may enable Tradefed to automatically retry failures or run some tests\nseveral times in iterations.\n\nSee [Automatic test retry](/docs/core/tests/tradefed/testing/through-tf/auto-retry) for more details.\n\n7. Retry isolation\n------------------\n\nYou may enable Tradefed to attempt to isolate the test execution between retry\nattempts.\n\nSee [Retry isolation](/docs/core/tests/tradefed/testing/through-tf/retry-isolation) for more details.\n\n8. Write a shell test\n---------------------\n\nSee [Write a shell test in Trade Federation](/docs/core/tests/tradefed/testing/through-tf/shell-test).\n\n9. Configure global test filters\n--------------------------------\n\nSee [Global filters in Trade Federation](/docs/core/tests/tradefed/testing/through-tf/global-filters)."]]