隔離主機測試
public class IsolatedHostTest
extends Object
implements IRemoteTest , IBuildReceiver , ITestAnnotationFilterReceiver , ITestFilterReceiver , IConfigurationReceiver , ITestCollector
java.lang.Object | |
↳ | com.android.tradefed.testtype.IsolatedHostTest |
實現一個 TradeFed 運行器,該運行器使用子進程在低依賴性環境中執行測試,而不是在主進程上執行它們。
此運行程序假定所有配置的 jar 都在同一個測試目錄中,並在該目錄中啟動子進程。由於它必須為子進程選擇一個工作目錄,並且許多測試都受益於該目錄作為測試目錄,因此這是可用的最佳折衷方案。
概括
公共構造函數 | |
---|---|
IsolatedHostTest () |
公共方法 | |
---|---|
void | addAllExcludeAnnotation ( notAnnotations) addAllExcludeAnnotation ( notAnnotations) 添加一個 |
void | addAllExcludeFilters ( filters) addAllExcludeFilters ( filters) 添加要排除的測試的過濾器的 |
void | addAllIncludeAnnotation ( annotations) addAllIncludeAnnotation ( annotations) 添加一個 |
void | addAllIncludeFilters ( filters) addAllIncludeFilters ( filters) 添加要包含哪些測試的過濾器的 |
void | addExcludeAnnotation (String notAnnotation) 添加註釋以排除是否測試是否用它標記。 |
void | addExcludeFilter (String filter) 添加要排除哪些測試的過濾器。 |
void | addIncludeAnnotation (String annotation) 添加一個註釋以包含如果一個測試是否用它標記。 |
void | addIncludeFilter (String filter) 添加要包含哪些測試的過濾器。 |
void | clearExcludeAnnotations () 刪除當前跟踪的所有排除註釋。 |
void | clearExcludeFilters () 刪除當前跟踪的所有排除過濾器。 |
void | clearIncludeAnnotations () 刪除當前跟踪的所有包含註釋。 |
void | clearIncludeFilters () 刪除當前跟踪的所有包含過濾器。 |
compileCommandArgs (String classpath, File artifactsDir) 組裝命令參數以執行子進程運行器。 | |
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 | useRobolectricResources () |
受保護的方法 | |
---|---|
String | compileLdLibraryPath () 為需要本機庫的測試返回 LD_LIBRARY_PATH。 |
File | getJarFile (String jarName, TestInformation testInfo) 從 HostTest 複製過來以模仿其單元測試利用。 |
void | setServer (ServerSocket server) |
公共構造函數
隔離主機測試
public IsolatedHostTest ()
公共方法
添加所有排除註釋
public void addAllExcludeAnnotation (notAnnotations)
添加一個ERROR(/Set)
註釋以排除是否測試是否用它標記。
參數 | |
---|---|
notAnnotations |
addAllIncludeAnnotation
public void addAllIncludeAnnotation (annotations)
添加一個ERROR(/Set)
註釋以包含是否測試是否用它標記。
參數 | |
---|---|
annotations |
添加排除註解
public void addExcludeAnnotation (String notAnnotation)
添加註釋以排除是否測試是否用它標記。
參數 | |
---|---|
notAnnotation | String |
添加排除過濾器
public void addExcludeFilter (String filter)
添加要排除哪些測試的過濾器。
參數 | |
---|---|
filter | String |
添加包含註解
public void addIncludeAnnotation (String annotation)
添加一個註釋以包含如果一個測試是否用它標記。
參數 | |
---|---|
annotation | String |
添加包含過濾器
public void addIncludeFilter (String filter)
添加要包含哪些測試的過濾器。
參數 | |
---|---|
filter | String |
清除排除註解
public void clearExcludeAnnotations ()
刪除當前跟踪的所有排除註釋。
清除排除過濾器
public void clearExcludeFilters ()
刪除當前跟踪的所有排除過濾器。
clearIncludeAnnotations
public void clearIncludeAnnotations ()
刪除當前跟踪的所有包含註釋。
清除包含過濾器
public void clearIncludeFilters ()
刪除當前跟踪的所有包含過濾器。
compileCommandArgs
publiccompileCommandArgs (String classpath, File artifactsDir)
組裝命令參數以執行子進程運行器。
參數 | |
---|---|
classpath | String |
artifactsDir | File |
退貨 | |
---|---|
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)
啟用或禁用測試收集模式
設置配置
public void setConfiguration (IConfiguration configuration)
注入正在使用的IConfiguration
。
參數 | |
---|---|
configuration | IConfiguration |
設置調試
public void setDebug (boolean debug)
參數 | |
---|---|
debug | boolean |
上傳測試工件
public void uploadTestArtifacts (File logDir, ITestInvocationListener listener)
參數 | |
---|---|
logDir | File |
listener | ITestInvocationListener |
使用 RobolectricResources
public boolean useRobolectricResources ()
退貨 | |
---|---|
boolean |
受保護的方法
compileLdLibraryPath
protected String compileLdLibraryPath ()
為需要本機庫的測試返回 LD_LIBRARY_PATH。
退貨 | |
---|---|
String | 指定以冒號分隔的庫路徑的字符串。 |
獲取JarFile
protected File getJarFile (String jarName, TestInformation testInfo)
從 HostTest 複製過來以模仿其單元測試利用。
檢查工件通常位於不同用例的幾個位置以找到我們的 jar。
參數 | |
---|---|
jarName | String |
testInfo | TestInformation |
退貨 | |
---|---|
File |
設置服務器
protected void setServer (ServerSocket server)
參數 | |
---|---|
server | ServerSocket |