CtsTestLauncher
public
class
CtsTestLauncher
extends Object
implements
IBuildReceiver,
IConfigurationReceiver,
IDeviceTest,
IInvocationContextReceiver,
IMetricCollectorReceiver,
IRemoteTest,
IShardableTest
| java.lang.Object | |
| ↳ | com.google.android.tradefed.testtype.CtsTestLauncher |
IRemoteTest,用於針對獨立的 CTS 安裝執行測試。
啟動外部 Java 程序來執行測試。用於執行特定下載的 CTS 版本及其設定。它會使用啟動它的目前版本 tradefed,完成缺少的 JAR
摘要
公用建構函式 | |
|---|---|
CtsTestLauncher()
|
|
CtsTestLauncher(int shardCount, int shardIndex)
|
|
公用方法 | |
|---|---|
String
|
buildClasspath()
建立子程序用來執行 CTS 的類別路徑 |
List<String>
|
buildJavaCmd(String classpath)
Creates the java command line that will be run in a sub process. |
String
|
getConfigName()
|
ITestDevice
|
getDevice()
取得受測裝置。 |
CommandResult
|
getResult()
|
void
|
run(TestInformation testInfo, ITestInvocationListener listener)
Runs the tests, and reports result to the 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 |
|
得分
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 |