自 2025 年 3 月 27 日起,我们建议您使用 android-latest-release
而非 aosp-main
构建 AOSP 并为其做出贡献。如需了解详情,请参阅 AOSP 的变更。
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
MergeStrategy
public
final
enum
MergeStrategy
extends Enum<MergeStrategy>
介绍在存在多次尝试时应如何汇总结果。
摘要
枚举值
ANY_FAIL_IS_FAIL
public static final MergeStrategy ANY_FAIL_IS_FAIL
如果单次运行或测试用例失败,无论如何状态都将为“失败”。
ANY_PASS_IS_PASS
public static final MergeStrategy ANY_PASS_IS_PASS
如果单次运行或测试用例通过,我们会将合并后的结果视为通过。
NO_MERGE
public static final MergeStrategy NO_MERGE
不应应用合并,否则会抛出异常。
ONE_TESTCASE_PASS_IS_PASS
public static final MergeStrategy ONE_TESTCASE_PASS_IS_PASS
如果单个测试用例通过,我们会将合并后的结果视为通过。
ONE_TESTRUN_PASS_IS_PASS
public static final MergeStrategy ONE_TESTRUN_PASS_IS_PASS
如果单次测试运行通过,我们会将合并的运行结果视为通过。
公共方法
getMergeStrategy
public static MergeStrategy getMergeStrategy (RetryStrategy retryStrategy)
根据重试策略创建合并策略。
参数 |
retryStrategy |
RetryStrategy |
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):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"]],["最后更新时间 (UTC):2025-07-27。"],[],[],null,["# MergeStrategy\n=============\n\n\n`\npublic\n\nfinal\n\nenum\nMergeStrategy\n`\n\n\n`\n\n\n`\n\n`\n\nextends Enum\u003c`[MergeStrategy](../../../../../../reference/tradefed/com/android/tradefed/retry/MergeStrategy.html)`\u003e\n\n\n`\n\n`\n\n\n`\n\n|---|---|------------------------------------------|\n| java.lang.Object |||\n| ↳ | java.lang.Enum\\\u003c[com.android.tradefed.retry.MergeStrategy](../../../../../../reference/tradefed/com/android/tradefed/retry/MergeStrategy.html)\\\u003e ||\n| | ↳ | com.android.tradefed.retry.MergeStrategy |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nDescribes how the results should be aggregated when multiple attempts are present.\n\nSummary\n-------\n\n| ### Enum values ||\n|-----------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------|\n| [MergeStrategy](../../../../../../reference/tradefed/com/android/tradefed/retry/MergeStrategy.html) | `ANY_FAIL_IS_FAIL` If a single run or test cases is failed, status will be failed no matter what. |\n| [MergeStrategy](../../../../../../reference/tradefed/com/android/tradefed/retry/MergeStrategy.html) | `ANY_PASS_IS_PASS` If a single run or test cases is a pass we will consider the merged results passed. |\n| [MergeStrategy](../../../../../../reference/tradefed/com/android/tradefed/retry/MergeStrategy.html) | `NO_MERGE` Merging should not be applied and will throw an exception. |\n| [MergeStrategy](../../../../../../reference/tradefed/com/android/tradefed/retry/MergeStrategy.html) | `ONE_TESTCASE_PASS_IS_PASS` If a single test case pass then we will consider the merged result passed. |\n| [MergeStrategy](../../../../../../reference/tradefed/com/android/tradefed/retry/MergeStrategy.html) | `ONE_TESTRUN_PASS_IS_PASS` If a single test run pass then we will consider the merged run result passed. |\n\n| ### Public methods ||\n|-----------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` static `[MergeStrategy](../../../../../../reference/tradefed/com/android/tradefed/retry/MergeStrategy.html) | ` `[getMergeStrategy](../../../../../../reference/tradefed/com/android/tradefed/retry/MergeStrategy.html#getMergeStrategy(com.android.tradefed.retry.RetryStrategy))`(`[RetryStrategy](../../../../../../reference/tradefed/com/android/tradefed/retry/RetryStrategy.html)` retryStrategy) ` Create a merge strategy based on the retry strategy. |\n| ` static `[MergeStrategy](../../../../../../reference/tradefed/com/android/tradefed/retry/MergeStrategy.html) | ` `[valueOf](../../../../../../reference/tradefed/com/android/tradefed/retry/MergeStrategy.html#valueOf(java.lang.String))`(String name) ` |\n| ` static final `[MergeStrategy[]](../../../../../../reference/tradefed/com/android/tradefed/retry/MergeStrategy.html) | ` `[values](../../../../../../reference/tradefed/com/android/tradefed/retry/MergeStrategy.html#values())`() ` |\n\nEnum values\n-----------\n\n### ANY_FAIL_IS_FAIL\n\n```\npublic static final MergeStrategy ANY_FAIL_IS_FAIL\n```\n\nIf a single run or test cases is failed, status will be failed no matter what.\n\n\u003cbr /\u003e\n\n### ANY_PASS_IS_PASS\n\n```\npublic static final MergeStrategy ANY_PASS_IS_PASS\n```\n\nIf a single run or test cases is a pass we will consider the merged results passed.\n\n\u003cbr /\u003e\n\n### NO_MERGE\n\n```\npublic static final MergeStrategy NO_MERGE\n```\n\nMerging should not be applied and will throw an exception.\n\n\u003cbr /\u003e\n\n### ONE_TESTCASE_PASS_IS_PASS\n\n```\npublic static final MergeStrategy ONE_TESTCASE_PASS_IS_PASS\n```\n\nIf a single test case pass then we will consider the merged result passed.\n\n\u003cbr /\u003e\n\n### ONE_TESTRUN_PASS_IS_PASS\n\n```\npublic static final MergeStrategy ONE_TESTRUN_PASS_IS_PASS\n```\n\nIf a single test run pass then we will consider the merged run result passed.\n\n\u003cbr /\u003e\n\nPublic methods\n--------------\n\n### getMergeStrategy\n\n```\npublic static MergeStrategy getMergeStrategy (RetryStrategy retryStrategy)\n```\n\nCreate a merge strategy based on the retry strategy.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|-----------------|------------------------|\n| `retryStrategy` | `RetryStrategy` \u003cbr /\u003e |\n\n| Returns ||\n|-----------------------------------------------------------------------------------------------------|--------|\n| [MergeStrategy](../../../../../../reference/tradefed/com/android/tradefed/retry/MergeStrategy.html) | \u003cbr /\u003e |\n\n### valueOf\n\n```\npublic static MergeStrategy valueOf (String name)\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Parameters ||\n|--------|-----------------|\n| `name` | `String` \u003cbr /\u003e |\n\n| Returns ||\n|-----------------------------------------------------------------------------------------------------|--------|\n| [MergeStrategy](../../../../../../reference/tradefed/com/android/tradefed/retry/MergeStrategy.html) | \u003cbr /\u003e |\n\n### values\n\n```\npublic static final MergeStrategy[] values ()\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|-------------------------------------------------------------------------------------------------------|--------|\n| [MergeStrategy[]](../../../../../../reference/tradefed/com/android/tradefed/retry/MergeStrategy.html) | \u003cbr /\u003e |"]]