自 2025 年 3 月 27 日起,我們建議您使用 android-latest-release
而非 aosp-main
建構及貢獻 AOSP。詳情請參閱「Android 開放原始碼計畫變更」。
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
TestDescriptionsFile
public
class
TestDescriptionsFile
extends Object
java.lang.Object
|
↳ |
com.android.tradefed.result.TestDescriptionsFile
|
實用工具類別,用於將 TestDescription 清單封裝並解封裝至測試檔案。
目的是透過延遲載入快取及盡量減少檔案 I/O。
不安全。
摘要
公用建構函式
TestDescriptionsFile
public TestDescriptionsFile ()
建立空白的測試說明清單。
TestDescriptionsFile
public TestDescriptionsFile (File file)
根據檔案內容建立測試說明清單。
公用方法
addAll
public void addAll ( test)
getFile
public File getFile ()
傳回測試的測試檔案表示法,並視需要建構測試。
測試會以不重複的方式排序。
getTests
public getTests ()
傳回儲存的測試副本 - 視需要從測試檔案建構。
populateTestFile
public void populateTestFile (File testfile)
使用目前的測試填入指定檔案。
這個頁面中的內容和程式碼範例均受《內容授權》中的授權所規範。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,["# TestDescriptionsFile\n====================\n\n\n`\npublic\n\n\nclass\nTestDescriptionsFile\n`\n\n\n`\n\nextends Object\n\n\n`\n\n`\n\n\n`\n\n|---|--------------------------------------------------|\n| java.lang.Object ||\n| ↳ | com.android.tradefed.result.TestDescriptionsFile |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nA utility class for marshalling and unmarshalling a list of TestDescriptions to a test file.\n\nIntended to cache and minimize file I/O by lazy loading.\n\nNOT thread safe.\n\nSummary\n-------\n\n| ### Public constructors ||\n|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| ` `[TestDescriptionsFile](../../../../../../reference/tradefed/com/android/tradefed/result/TestDescriptionsFile.html#TestDescriptionsFile())`() ` Create an empty test description list. |\n| ` `[TestDescriptionsFile](../../../../../../reference/tradefed/com/android/tradefed/result/TestDescriptionsFile.html#TestDescriptionsFile(File))`(File file) ` Create a test description list from the file contents. |\n\n| ### Public methods ||\n|------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` void` | ` `[add](../../../../../../reference/tradefed/com/android/tradefed/result/TestDescriptionsFile.html#add(com.android.tradefed.result.TestDescription))`(`[TestDescription](../../../../../../reference/tradefed/com/android/tradefed/result/TestDescription.html)` test) ` |\n| ` void` | ` `[addAll](../../../../../../reference/tradefed/com/android/tradefed/result/TestDescriptionsFile.html#addAll(\u003cany\u003e))`(` test) |\n| ` static `[TestDescriptionsFile](../../../../../../reference/tradefed/com/android/tradefed/result/TestDescriptionsFile.html) | ` `[fromTests](../../../../../../reference/tradefed/com/android/tradefed/result/TestDescriptionsFile.html#fromTests(\u003cany\u003e))`(` shardTests) |\n| ` File` | ` `[getFile](../../../../../../reference/tradefed/com/android/tradefed/result/TestDescriptionsFile.html#getFile())`() ` Return the test file representation of the tests - building it if necessary. |\n| ` ` | ` `[getTests](../../../../../../reference/tradefed/com/android/tradefed/result/TestDescriptionsFile.html#getTests())`() ` Return a copy of the tests stored - building from test file if necessary. |\n| ` void` | ` `[populateTestFile](../../../../../../reference/tradefed/com/android/tradefed/result/TestDescriptionsFile.html#populateTestFile(File))`(File testfile) ` Populates the given file with the current tests. |\n| ` void` | ` `[remove](../../../../../../reference/tradefed/com/android/tradefed/result/TestDescriptionsFile.html#remove(com.android.tradefed.result.TestDescription))`(`[TestDescription](../../../../../../reference/tradefed/com/android/tradefed/result/TestDescription.html)` test) ` |\n| ` int` | ` `[size](../../../../../../reference/tradefed/com/android/tradefed/result/TestDescriptionsFile.html#size())`() ` |\n\nPublic constructors\n-------------------\n\n### TestDescriptionsFile\n\n```\npublic TestDescriptionsFile ()\n```\n\nCreate an empty test description list.\n\n\u003cbr /\u003e\n\n### TestDescriptionsFile\n\n```\npublic TestDescriptionsFile (File file)\n```\n\nCreate a test description list from the file contents.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|--------|---------------|\n| `file` | `File` \u003cbr /\u003e |\n\nPublic methods\n--------------\n\n### add\n\n```\npublic void add (TestDescription test)\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Parameters ||\n|--------|--------------------------|\n| `test` | `TestDescription` \u003cbr /\u003e |\n\n### addAll\n\n```\npublic void addAll ( test)\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Parameters ||\n|--------|--------|\n| `test` | \u003cbr /\u003e |\n\n### fromTests\n\n```\npublic static TestDescriptionsFile fromTests ( shardTests)\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Parameters ||\n|--------------|--------|\n| `shardTests` | \u003cbr /\u003e |\n\n| Returns ||\n|--------------------------------------------------------------------------------------------------------------------|--------|\n| [TestDescriptionsFile](../../../../../../reference/tradefed/com/android/tradefed/result/TestDescriptionsFile.html) | \u003cbr /\u003e |\n\n### getFile\n\n```\npublic File getFile ()\n```\n\nReturn the test file representation of the tests - building it if necessary.\n\nTests will be unique and sorted.\n\n\u003cbr /\u003e\n\n| Returns ||\n|--------|--------|\n| `File` | \u003cbr /\u003e |\n\n### getTests\n\n```\npublic getTests ()\n```\n\nReturn a copy of the tests stored - building from test file if necessary.\n\n\u003cbr /\u003e\n\n| Returns ||\n|---|--------|\n| | \u003cbr /\u003e |\n\n### populateTestFile\n\n```\npublic void populateTestFile (File testfile)\n```\n\nPopulates the given file with the current tests.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|------------|---------------|\n| `testfile` | `File` \u003cbr /\u003e |\n\n### remove\n\n```\npublic void remove (TestDescription test)\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Parameters ||\n|--------|--------------------------|\n| `test` | `TestDescription` \u003cbr /\u003e |\n\n### size\n\n```\npublic int size ()\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|-------|--------|\n| `int` | \u003cbr /\u003e |"]]