自 2025 年 3 月 27 日起,我們建議您使用 android-latest-release
而非 aosp-main
建構及貢獻 AOSP。詳情請參閱「Android 開放原始碼計畫變更」。
開始使用 TF
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
Trade Federation 是一個大型測試基礎架構,可配合各種不同用途進行調整,但大多數人可能只需要其中部分功能。首先,我們認為 TF 使用者會擔任以下三個主要角色之一:開發人員、整合人員和測試執行者。某位特定人員可能會擔任這三種 (或全部) 角色,但我們認為這項區分方式有助於您更輕鬆地瀏覽說明文件。
開發人員
開發人員花費大部分時間建立以 Java 編寫的 TF 模組。他們可能會編寫設定並執行測試,但通常只會這樣做,以驗證模組是否已正確叫用,並且正常運作。
整合商
整合服務供應商會將大部分時間用於建立 XML 測試設定或指令檔案 (以簡易的殼層語言編寫)。這些檔案會將開發人員編寫的 TF 模組與特定測試需求和目標所需的特定設定連結在一起。
測試執行工具
測試執行程式會將大部分時間用於執行測試,並確保產生測試結果,且產生的測試結果相關、可重現且準確。他們大部分時間都會與 Tradefed 的命令列介面互動,並且會驗證結果是否合理。
為了充分運用 Trade Federation,您必須代表這三個角色。開發人員和整合者必須讓 TF 與其他基礎架構元件互通,例如建構系統和測試結果存放區。您必須使用整合器和測試執行工具,才能讓 TF 實際執行所需的測試,並產生所需的測試結果。您必須使用 Test Runner 找出不合理的結果,並與開發人員和整合業者合作,找出錯誤可能出現的位置並加以修正。
後續步驟
所有三個角色的人員至少應瀏覽所有其他文件。機器設定可讓您執行 TF (透過建構或下載)。「使用裝置」一文將說明如何使用實體裝置、模擬器或不使用任何裝置來執行測試。「測試生命週期」頁面會從理論層面說明開發人員、整合者和測試執行工具的角色如何互動,接著「選項處理」會示範如何將理論付諸實踐。
最後,端對端範例會逐步引導您開發、整合及部署範例測試。這份文件涵蓋各個角色的各個層面,並應提供提示,說明如何執行說明文件中未直接討論的更複雜工作。
如果您已查看本文所有內容,但仍有未解答的問題,請先試著查看 Trade Federation 原始碼。除此之外,歡迎您嘗試在 android-platform Google 網路論壇上提問。為獲得最佳成效,請務必在訊息主旨中提及「Trade Federation」(或「tradefed」或「TF」)。
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。Java 與 OpenJDK 是 Oracle 和/或其關係企業的商標或註冊商標。
上次更新時間:2025-07-27 (世界標準時間)。
[[["容易理解","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-07-27 (世界標準時間)。"],[],[],null,["# Get started with TF\n\nTrade Federation is a large test infrastructure that can be adapted to a great variety of\ndifferent usecases, and most people will probably only need some subset of its functionality. First\noff, we envision that TF users will fulfill any of three primary roles: Developer, Integrator, and\nTest Runner. A particular individual might wear any (or all) of those three hats, but we feel the\ndistinction will help make it easier to navigate the documentation.\n\nDevelopers\n----------\n\nDevelopers spend the majority of their time creating TF modules that are written in Java.\nThey may write configurations and execute tests, but will typically only do so to verify that their\nmodules are being invoked properly and are functioning as expected.\n\nIntegrators\n-----------\n\nIntegrators spend the majority of their time creating XML test configurations, or command\nfiles (which are written in a simple shell-like language). They tie together TF modules written\nby the Developer with specific configurations that are required for particular test requirements and\ngoals.\n\nTest Runners\n------------\n\nTest Runners spend the majority of their time executing tests and generally making sure\nthat test results are being generated, and that the generated test results are relevant,\nreproducible, and accurate. They spend the majority of their time interacting with tradefed's\ncommand line interface, and will also verify that the results make sense.\n\nIn order to get the most out of Trade Federation, all three roles will need to be represented.\nIt will take Developers and Integrators to make TF interoperate with other pieces of infrastructure,\nlike build systems and test result repositories. It will take Integrators and Test Runners to get\nTF to actually run the desired tests and produce the desired test results. It will take Test\nRunners to identify results that don't make sense, and to work with the Developers and\nIntegrators to figure out where the bugs may lie and get them fixed.\n\nWhat's next\n-----------\n\nPeople in all three roles should at least glance through all the rest of the docs.\n[Machine Setup](/docs/core/tests/tradefed/fundamentals/machine_setup) will get you to the point where you can run TF (by building or downloading it).\n[Working with Devices](/docs/core/tests/tradefed/fundamentals/devices) will explain how to run tests with a physical device, with an emulator, or\nwith no device at all. The\n[Test Lifecycle](/docs/core/tests/tradefed/fundamentals/lifecycle) page will explain from a theoretical perspective how the roles of the\nDeveloper, Integrator, and Test Runner interact, and then\n[Option Handling](/docs/core/tests/tradefed/fundamentals/options) will demonstrate how to put that theory into practice.\n\nFinally, the [End-to-End Example](/docs/core/tests/tradefed/fundamentals/full_example) takes you through the development, integration, and deployment of a sample\ntest. It involves aspects of each role, and should offer hints at how to do more complicated\nthings that aren't directly discussed in the documentation.\n\nIf you've gotten through everything here and still have unanswered questions, first try taking\na look at the [Trade Federation source code](https://android.googlesource.com/platform/tools/tradefederation/+/main). Beyond that, feel free to try asking on the\n[android-platform](/docs/setup/community) Google Group. For best results, make\nsure to mention \"Trade Federation\" (or \"tradefed\", or \"TF\") in the message subject."]]