IsolatedHostTest
public
class
IsolatedHostTest
extends Object
implements
IBuildReceiver,
IConfigurationReceiver,
IRemoteTest,
ITestAnnotationFilterReceiver,
ITestCollector,
ITestFilterReceiver
java.lang.Object | |
↳ | com.android.tradefed.testtype.IsolatedHostTest |
實作 TradeFed 執行程式,使用子程序在低依附元件環境中執行測試,而非在主要程序中執行。
這個執行程式會假設所有已設定的 JAR 檔案都位於同一個測試目錄中,並在該目錄中啟動子程序。由於它必須為子程序選擇工作目錄,且許多測試都會從該目錄為測試目錄而受益,因此這是最佳折衷方案。
摘要
公用建構函式 | |
---|---|
IsolatedHostTest()
|
公用方法 | |
---|---|
void
|
addAllExcludeAnnotation(
新增 |
void
|
addAllExcludeFilters(
新增篩選器的 |
void
|
addAllIncludeAnnotation(
新增註解的 |
void
|
addAllIncludeFilters(
新增篩選器的 |
void
|
addExcludeAnnotation(String notAnnotation)
新增註解,用於排除標示為此註解的測試。 |
void
|
addExcludeFilter(String filter)
新增篩選器,用於排除要排除的測試。 |
void
|
addIncludeAnnotation(String annotation)
新增註解,用於在測試標記為此註解時加入註解。 |
void
|
addIncludeFilter(String filter)
新增篩選器,用於篩選要納入的測試。 |
void
|
clearExcludeAnnotations()
刪除目前追蹤的所有排除註解。 |
void
|
clearExcludeFilters()
刪除目前追蹤的所有排除篩選條件。 |
void
|
clearIncludeAnnotations()
刪除目前追蹤的所有包含註解。 |
void
|
clearIncludeFilters()
刪除目前追蹤的所有包含篩選器。 |
String
|
compileClassPath()
為子程序建立 classpath,其中包含執行測試所需的 JAR |
|
compileCommandArgs(String classpath, File artifactsDir)
組合指令引數,以便執行子程序執行程式。 |
void
|
deleteTempFiles()
|
File
|
getCoverageExecFile()
|
|
getExcludeAnnotations()
傳回要排除的註解的目前 |
|
getExcludeFilters()
傳回排除篩選器的目前 |
|
getIncludeAnnotations()
傳回要納入的註解目前的 |
|
getIncludeFilters()
傳回目前的包含篩選器 |
void
|
run(TestInformation testInfo, ITestInvocationListener listener)
執行測試,並將結果回報給監聽器。 |
void
|
setBuild(IBuildInfo build)
|
void
|
setCollectTestsOnly(boolean shouldCollectTest)
啟用或停用測試收集模式 |
void
|
setConfiguration(IConfiguration configuration)
插入正在使用的 |
void
|
setDebug(boolean debug)
|
void
|
uploadTestArtifacts(File logDir, ITestInvocationListener listener)
|
boolean
|
useRavenwoodResources()
|
boolean
|
useRobolectricResources()
|
受保護的方法 | |
---|---|
String
|
compileLdLibraryPathInner(String androidHostOut)
我們會從單元測試呼叫這個版本,並直接傳遞 ANDROID_HOST_OUT。 |
File
|
getJarFile(String jarName, TestInformation testInfo)
從 HostTest 複製過來,用於模擬單元測試的束縛。 |
void
|
setServer(ServerSocket server)
|
公用建構函式
IsolatedHostTest
public IsolatedHostTest ()
公用方法
addAllExcludeAnnotation
public void addAllExcludeAnnotation (notAnnotations)
新增 ERROR(/Set)
註解,以便在測試標示為排除時使用。
參數 | |
---|---|
notAnnotations |
|
addAllExcludeFilters
public void addAllExcludeFilters (filters)
新增篩選器的 ERROR(/Set)
,用於排除要排除的測試。
參數 | |
---|---|
filters |
|
addAllIncludeAnnotation
public void addAllIncludeAnnotation (annotations)
新增註解的 ERROR(/Set)
,如果測試標記為註解,則會納入。
參數 | |
---|---|
annotations |
|
addAllIncludeFilters
public void addAllIncludeFilters (filters)
新增篩選器的 ERROR(/Set)
,用於指定要納入哪些測試。
參數 | |
---|---|
filters |
|
addExcludeAnnotation
public void addExcludeAnnotation (String notAnnotation)
新增註解,用於排除標示為此註解的測試。
參數 | |
---|---|
notAnnotation |
String |
addExcludeFilter
public void addExcludeFilter (String filter)
新增篩選器,用於排除要排除的測試。
參數 | |
---|---|
filter |
String |
addIncludeAnnotation
public void addIncludeAnnotation (String annotation)
新增註解,用於在測試標記為此註解時加入。
參數 | |
---|---|
annotation |
String |
addIncludeFilter
public void addIncludeFilter (String filter)
新增篩選器,用於篩選要納入的測試。
參數 | |
---|---|
filter |
String |
clearExcludeAnnotations
public void clearExcludeAnnotations ()
刪除目前追蹤的所有排除註解。
clearExcludeFilters
public void clearExcludeFilters ()
刪除目前追蹤的所有排除篩選條件。
clearIncludeAnnotations
public void clearIncludeAnnotations ()
刪除目前追蹤的所有納入註解。
clearIncludeFilters
public void clearIncludeFilters ()
刪除目前追蹤的所有包含篩選器。
compileClassPath
public String compileClassPath ()
為子程序建立 classpath,其中包含執行測試所需的 JAR
傳回 | |
---|---|
String |
指定以冒號分隔的類別路徑的字串。 |
compileCommandArgs
publiccompileCommandArgs (String classpath, File artifactsDir)
組合指令引數,以便執行子程序執行程式。
參數 | |
---|---|
classpath |
String |
artifactsDir |
File |
傳回 | |
---|---|
|
deleteTempFiles
public void deleteTempFiles ()
getCoverageExecFile
public File getCoverageExecFile ()
傳回 | |
---|---|
File |
得分
public void run (TestInformation testInfo, ITestInvocationListener listener)
執行測試,並將結果回報給監聽器。
參數 | |
---|---|
testInfo |
TestInformation :包含執行測試所需實用資訊的 TestInformation 物件。 |
listener |
ITestInvocationListener :測試結果的 ITestInvocationListener |
擲回 | |
---|---|
DeviceNotAvailableException |
setCollectTestsOnly
public void setCollectTestsOnly (boolean shouldCollectTest)
啟用或停用測試收集模式
setConfiguration
public void setConfiguration (IConfiguration configuration)
插入正在使用的 IConfiguration
。
參數 | |
---|---|
configuration |
IConfiguration |
setDebug
public void setDebug (boolean debug)
參數 | |
---|---|
debug |
boolean |
uploadTestArtifacts
public void uploadTestArtifacts (File logDir, ITestInvocationListener listener)
參數 | |
---|---|
logDir |
File |
listener |
ITestInvocationListener |
useRavenwoodResources
public boolean useRavenwoodResources ()
傳回 | |
---|---|
boolean |
useRobolectricResources
public boolean useRobolectricResources ()
傳回 | |
---|---|
boolean |
受保護的方法
compileLdLibraryPathInner
protected String compileLdLibraryPathInner (String androidHostOut)
我們會從單元測試呼叫這個版本,並直接傳遞 ANDROID_HOST_OUT。我們需要這個變數,因為 Java 沒有用來設定環境變數的 API。
參數 | |
---|---|
androidHostOut |
String |
傳回 | |
---|---|
String |
getJarFile
protected File getJarFile (String jarName, TestInformation testInfo)
從 HostTest 複製過來,用於模擬單元測試的束縛。
檢查幾個通常用於不同用途的建構物位置,找出我們的 JAR 檔案。
參數 | |
---|---|
jarName |
String |
testInfo |
TestInformation |
傳回 | |
---|---|
File |
setServer
protected void setServer (ServerSocket server)
參數 | |
---|---|
server |
ServerSocket |