自 2025 年 3 月 27 日起,我們建議您使用 android-latest-release
而非 aosp-main
建構及貢獻 AOSP。詳情請參閱「Android 開放原始碼計畫變更」。
開發 Tradefed
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
本節適用對象為 Tradefed 開發人員。如果您有意擴充 TF 或新增測試支援功能,請參閱本節。
開放原始碼
如果您打算使用 Trade Federation 的開放原始碼變化版本,請使用下列指令檢查並建構 Trade Federation 的 AOSP android-latest-release
分支:
cd <sourceroot>
mkdir android-latest-release
cd android-latest-release
repo init -u https://android.googlesource.com/platform/manifest -b android-latest-release
repo sync -c -j8
source build/envsetup.sh
lunch aosp_cf_arm64_only_phone-userdebug # or any other device target
m -j tradefed-all
詳情請參閱「開發環境」。
所有可開放原始碼的 Trade Federation 程式碼都儲存在 Android 開放原始碼計畫的 tools/tradefederation/ Git 專案中。撰寫程式碼和提交變更時,請遵守開放原始碼規範。
或者,如果您要建立使用 Trade Federation 的測試/公用程式,但不使用該架構本身,建議您將工作放入其中一個 Trade Federation 貢獻專案,以便加快核准作業。
程式碼樣式
Trade Federation 遵循 Android 程式碼樣式指南,並提供以下說明:介面名稱的前置字元為「I」,例如 ITestDevice。
使用 Eclipse 進行開發
如果您想在開發 Tradefed 時使用 Eclipse,請參閱「設定 Eclipse IDE」一文,瞭解如何設定環境。
執行 Tradefed 的測試
您對 Trade Federation 進行了變更,想知道如何進行測試嗎?請參閱「執行 Trade Federation 的測試」。
建築
如要進一步瞭解 Tradefed 的內部運作方式,請參閱「架構」一節。
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。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,["# Develop Tradefed\n\nThis section is aimed at Tradefed developers. If you are interested in extending\nTF or adding new test support, this is the section for you.\n\nOpen source\n-----------\n\nIf you plan to use the open source variant of Trade Federation, use these\ncommands to check out and build the AOSP `android-latest-release` branch of\nTrade Federation: \n\n cd \u003csourceroot\u003e\n mkdir android-latest-release\n cd android-latest-release\n repo init -u https://android.googlesource.com/platform/manifest -b android-latest-release\n repo sync -c -j8\n source build/envsetup.sh\n lunch aosp_cf_arm64_only_phone-userdebug # or any other device target\n m -j tradefed-all\n\nSee [Development Environment](/docs/core/tests/tradefed/fundamentals/machine_setup)\nfor more details.\n\nAll open-sourceable Trade Federation code is stored in the\n[tools/tradefederation/](https://android.googlesource.com/platform/tools/tradefederation/)\ngit project of AOSP. Please keep the\n[open source guidelines](/docs/setup/contribute/code-style)\nin mind when writing code and submitting changes.\n\nAlternatively, if you are creating tests/utilities that use Trade Federation but\naren't working on the framework itself, consider placing your work inside one of\nthe [Trade Federation contrib projects](/docs/core/tests/tradefed/development/contribute-noncore) to speed approvals.\n\nCoding style\n------------\n\nTrade Federation follows the\n[Android coding style guidelines](/source/code-style),\nwith the following clarifications: interface names are prefixed with 'I' e.g.\nITestDevice.\n\nDevelop using Eclipse\n---------------------\n\nIf you are interested in using Eclipse in developing Tradefed, refer to\n[Set up Eclipse IDE](/docs/core/tests/tradefed/development/eclipse) for tips on\nsetting up your environment.\n\nRun Tradefed's tests\n--------------------\n\nYou made a change to Trade Federation and you are searching how to test it? see\n[Running Trade Federation's tests](/docs/core/tests/tradefed/development/tf-tests).\n\nArchitecture\n------------\n\nIf you seek a deeper understanding of the innerworkings of Tradefed, see the\n[Architecture](/docs/core/tests/tradefed/architecture) section."]]