CtsTestLauncher
public
class
CtsTestLauncher
extends Object
implements
IBuildReceiver,
IConfigurationReceiver,
IDeviceTest,
IInvocationContextReceiver,
IMetricCollectorReceiver,
IRemoteTest,
IShardableTest
| java.lang.Object | |
| ↳ | com.google.android.tradefed.testtype.CtsTestLauncher |
用于针对单独的 CTS 安装运行测试的 IRemoteTest。
启动外部 Java 进程来运行测试。用于运行特定下载的 CTS 版本及其配置。它将使用启动它的当前版本的 Tradefed 来完成缺少的 jar
摘要
公共构造函数 | |
|---|---|
CtsTestLauncher()
|
|
CtsTestLauncher(int shardCount, int shardIndex)
|
|
公共方法 | |
|---|---|
String
|
buildClasspath()
创建子进程用于运行 CTS 的类路径 |
List<String>
|
buildJavaCmd(String classpath)
创建将在子进程中运行的 Java 命令行。 |
String
|
getConfigName()
|
ITestDevice
|
getDevice()
获取被测设备。 |
CommandResult
|
getResult()
|
void
|
run(TestInformation testInfo, ITestInvocationListener listener)
运行测试,并将结果报告给监听器。 |
void
|
setBuild(IBuildInfo buildInfo)
|
void
|
setConfigName(String config)
|
void
|
setConfiguration(IConfiguration configuration)
注入正在使用的 |
void
|
setCtsVersion(int version)
|
void
|
setDevice(ITestDevice device)
注入被测设备。 |
void
|
setInvocationContext(IInvocationContext invocationContext)
|
void
|
setMetricCollectors(List<IMetricCollector> collectors)
设置为测试运行定义的 |
Collection<IRemoteTest>
|
split(int shardCountHint)
|
受保护的方法 | |
|---|---|
IRunUtil
|
getRunUtil()
|
String
|
getSystemJava()
|
void
|
setRunAsRoot(boolean runAsRoot)
|
公共构造函数
CtsTestLauncher
public CtsTestLauncher ()
CtsTestLauncher
public CtsTestLauncher (int shardCount,
int shardIndex)| 参数 | |
|---|---|
shardCount |
int |
shardIndex |
int |
公共方法
buildClasspath
public String buildClasspath ()
创建子进程用于运行 CTS 的类路径
| 返回 | |
|---|---|
String |
包含完整类路径的字符串。 |
| 抛出 | |
|---|---|
IOException |
|
buildJavaCmd
public List<String> buildJavaCmd (String classpath)
创建将在子进程中运行的 Java 命令行。
| 参数 | |
|---|---|
classpath |
String:运行 CTS/XTS 所需的 jar 文件的 Java 类路径 |
| 返回 | |
|---|---|
List<String> |
包含 java 命令行和参数的 ArrayList |
| 抛出 | |
|---|---|
DeviceNotAvailableException |
|
getConfigName
public String getConfigName ()
| 返回 | |
|---|---|
String |
|
run
public void run (TestInformation testInfo, ITestInvocationListener listener)
运行测试,并将结果报告给监听器。
| 参数 | |
|---|---|
testInfo |
TestInformation:包含用于运行测试的实用信息的 TestInformation 对象。 |
listener |
ITestInvocationListener:测试结果的 ITestInvocationListener |
| 抛出 | |
|---|---|
DeviceNotAvailableException |
|
setConfigName
public void setConfigName (String config)
| 参数 | |
|---|---|
config |
String |
setConfiguration
public void setConfiguration (IConfiguration configuration)
注入正在使用的 IConfiguration。
| 参数 | |
|---|---|
configuration |
IConfiguration |
setCtsVersion
public void setCtsVersion (int version)
| 参数 | |
|---|---|
version |
int |
setInvocationContext
public void setInvocationContext (IInvocationContext invocationContext)
| 参数 | |
|---|---|
invocationContext |
IInvocationContext |
setMetricCollectors
public void setMetricCollectors (List<IMetricCollector> collectors)
设置为测试运行定义的 IMetricCollector 列表。
| 参数 | |
|---|---|
collectors |
List |
分解
public Collection<IRemoteTest> split (int shardCountHint)
split() 的替代版本,还提供尝试运行的 shardCount。这对于有时无法任意决定的某些测试运行程序非常有用。
| 参数 | |
|---|---|
shardCountHint |
int:尝试分片的数量。 |
| 返回 | |
|---|---|
Collection<IRemoteTest> |
要单独执行的子测试集合,如果测试目前无法分片,则为 null |
受保护的方法
getSystemJava
protected String getSystemJava ()
| 返回 | |
|---|---|
String |
|
setRunAsRoot
protected void setRunAsRoot (boolean runAsRoot)
| 参数 | |
|---|---|
runAsRoot |
boolean |