自 2025 年 3 月 27 日起,我们建议您使用 android-latest-release
而非 aosp-main
构建 AOSP 并为其做出贡献。如需了解详情,请参阅 AOSP 的变更。
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
TfTestLauncher
public
class
TfTestLauncher
extends SubprocessTfLauncher
用于针对单独的 TF 安装运行单元测试或功能测试的 IRemoteTest
。
启动外部 Java 进程以运行测试。用于持续运行 TF 单元测试或功能测试。
摘要
公共构造函数
TfTestLauncher
public TfTestLauncher ()
受保护的方法
addJavaArguments
protected void addJavaArguments ( args)
允许向子进程调用添加额外的 Java 参数。
参数 |
args |
:我们需要向其添加额外参数的当前参数列表。 |
postRun
protected void postRun (ITestInvocationListener listener,
boolean exception,
long elapsedTime)
TF 测试完成后要执行的操作。
参数 |
listener |
ITestInvocationListener :用于报告结果的原始 ITestInvocationListener 。 |
exception |
boolean :如果测试中引发了异常,则为 True。 |
elapsedTime |
long :运行测试所用的时间。 |
preRun
protected void preRun ()
运行测试前的设置。
testTmpDirClean
protected void testTmpDirClean (File tmpDir,
ITestInvocationListener listener)
额外测试,用于确保子进程中的单元测试不会创建任何文件,也不会清理任何文件。
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-27。
[null,null,["最后更新时间 (UTC):2025-07-27。"],[],[],null,["# TfTestLauncher\n==============\n\n\n`\npublic\n\n\nclass\nTfTestLauncher\n`\n\n\n`\n\n\n`\n\n`\n\nextends `[SubprocessTfLauncher](../../../../../../reference/tradefed/com/android/tradefed/testtype/SubprocessTfLauncher.html)`\n\n\n`\n\n`\n\n\n`\n\n|---|---|----------------------------------------------|\n| java.lang.Object |||\n| ↳ | [com.android.tradefed.testtype.SubprocessTfLauncher](../../../../../../reference/tradefed/com/android/tradefed/testtype/SubprocessTfLauncher.html) ||\n| | ↳ | com.android.tradefed.testtype.TfTestLauncher |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nA [IRemoteTest](../../../../../../reference/tradefed/com/android/tradefed/testtype/IRemoteTest.html) for running unit or functional tests against a separate TF installation.\n\n\u003cbr /\u003e\n\nLaunches an external java process to run the tests. Used for running the TF unit or functional tests continuously.\n\n\u003cbr /\u003e\n\nSummary\n-------\n\n| ### Public constructors ||\n|-----------------------------------------------------------------------------------------------------------------------------------|---|\n| ` `[TfTestLauncher](../../../../../../reference/tradefed/com/android/tradefed/testtype/TfTestLauncher.html#TfTestLauncher())`() ` |\n\n| ### Protected methods ||\n|---------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` void` | ` `[addJavaArguments](../../../../../../reference/tradefed/com/android/tradefed/testtype/TfTestLauncher.html#addJavaArguments(\u003cany\u003e))`(` args) Allow to add extra java parameters to the subprocess invocation. |\n| ` void` | ` `[postRun](../../../../../../reference/tradefed/com/android/tradefed/testtype/TfTestLauncher.html#postRun(com.android.tradefed.result.ITestInvocationListener,%20boolean,%20long))`(`[ITestInvocationListener](../../../../../../reference/tradefed/com/android/tradefed/result/ITestInvocationListener.html)` listener, boolean exception, long elapsedTime) ` Actions to take after the TF test is finished. |\n| ` void` | ` `[preRun](../../../../../../reference/tradefed/com/android/tradefed/testtype/TfTestLauncher.html#preRun())`() ` Setup before running the test. |\n| ` void` | ` `[testTmpDirClean](../../../../../../reference/tradefed/com/android/tradefed/testtype/TfTestLauncher.html#testTmpDirClean(File,%20com.android.tradefed.result.ITestInvocationListener))`(File tmpDir, `[ITestInvocationListener](../../../../../../reference/tradefed/com/android/tradefed/result/ITestInvocationListener.html)` listener) ` Extra test to ensure no files are created by the unit tests in the subprocess and not cleaned. |\n\nPublic constructors\n-------------------\n\n### TfTestLauncher\n\n```\npublic TfTestLauncher ()\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nProtected methods\n-----------------\n\n### addJavaArguments\n\n```\nprotected void addJavaArguments ( args)\n```\n\nAllow to add extra java parameters to the subprocess invocation.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|--------|--------------------------------------------------------------------------------|\n| `args` | : the current list of arguments to which we need to add the extra ones. \u003cbr /\u003e |\n\n### postRun\n\n```\nprotected void postRun (ITestInvocationListener listener, \n boolean exception, \n long elapsedTime)\n```\n\nActions to take after the TF test is finished.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|---------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `listener` | `ITestInvocationListener`: the original [ITestInvocationListener](../../../../../../reference/tradefed/com/android/tradefed/result/ITestInvocationListener.html) where to report results. \u003cbr /\u003e |\n| `exception` | `boolean`: True if exception was raised inside the test. \u003cbr /\u003e |\n| `elapsedTime` | `long`: the time taken to run the tests. \u003cbr /\u003e |\n\n### preRun\n\n```\nprotected void preRun ()\n```\n\nSetup before running the test.\n\n\u003cbr /\u003e\n\n### testTmpDirClean\n\n```\nprotected void testTmpDirClean (File tmpDir, \n ITestInvocationListener listener)\n```\n\nExtra test to ensure no files are created by the unit tests in the subprocess and not\ncleaned.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `tmpDir` | `File`: the temporary dir of the subprocess. \u003cbr /\u003e |\n| `listener` | `ITestInvocationListener`: the [ITestInvocationListener](../../../../../../reference/tradefed/com/android/tradefed/result/ITestInvocationListener.html) where to report the test. \u003cbr /\u003e |"]]