隔離主機測試

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)

新增ERROR(/Set)註解以排除測試是否用它標記。

void addAllExcludeFilters ( filters) addAllExcludeFilters ( filters)

新增要排除的測試的過濾器的ERROR(/Set)

void addAllIncludeAnnotation ( annotations) addAllIncludeAnnotation ( annotations)

新增ERROR(/Set)註解以包含測試是否用它標記。

void addAllIncludeFilters ( filters) addAllIncludeFilters ( filters)

新增要包含的測試的過濾器的ERROR(/Set)

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 ()

為子進程建立一個類別路徑,其中包含執行測試所需的 jar

compileCommandArgs (String classpath, File artifactsDir)

組裝命令參數以執行子進程運行程式。

void deleteTempFiles ()
File getCoverageExecFile ()
getExcludeAnnotations ()

傳回要排除的註釋的目前ERROR(/Set)

getExcludeFilters ()

傳回排除過濾器的目前ERROR(/Set)

getIncludeAnnotations ()

傳回要包含的註解的目前ERROR(/Set)

getIncludeFilters ()

傳回包含篩選器的目前ERROR(/Set)

void run ( TestInformation testInfo, ITestInvocationListener listener)

運行測試,並將結果報告給偵聽器。

void setBuild ( IBuildInfo build)

void setCollectTestsOnly (boolean shouldCollectTest)

啟用或停用測試收集模式

void setConfiguration ( IConfiguration configuration)

注入正在使用的IConfiguration

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)

公共構造函數

隔離主機測試

public IsolatedHostTest ()

公共方法

新增全部排除註釋

public void addAllExcludeAnnotation ( notAnnotations)

新增ERROR(/Set)註解以排除測試是否用它標記。

參數
notAnnotations

新增所有排除過濾器

public void addAllExcludeFilters ( filters)

新增要排除的測試的過濾器的ERROR(/Set)

參數
filters

新增全部包含註釋

public void addAllIncludeAnnotation ( annotations)

新增ERROR(/Set)註解以包含測試是否用它標記。

參數
annotations

添加所有包含過濾器

public void addAllIncludeFilters ( filters)

新增要包含的測試的過濾器的ERROR(/Set)

參數
filters

新增排除註釋

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 ()

刪除目前追蹤的所有排除過濾器。

清除包含註釋

public void clearIncludeAnnotations ()

刪除目前追蹤的所有包含註釋。

清除包含過濾器

public void clearIncludeFilters ()

刪除目前追蹤的所有包含過濾器。

編譯類路徑

public String compileClassPath ()

為子進程建立一個類別路徑,其中包含執行測試所需的 jar

退貨
String指定用冒號分隔的類別路徑的字串。

編譯命令參數

public  compileCommandArgs (String classpath, 
                File artifactsDir)

組裝命令參數以執行子進程運行程式。

參數
classpath String

artifactsDir File

退貨

刪除臨時文件

public void deleteTempFiles ()

取得覆蓋執行文件

public File getCoverageExecFile ()

退貨
File

取得排除註釋

public  getExcludeAnnotations ()

傳回要排除的註釋的目前ERROR(/Set)

退貨

取得排除過濾器

public  getExcludeFilters ()

傳回排除過濾器的目前ERROR(/Set)

退貨

取得包含註釋

public  getIncludeAnnotations ()

傳回要包含的註解的目前ERROR(/Set)

退貨

取得包含過濾器

public  getIncludeFilters ()

傳回包含篩選器的目前ERROR(/Set)

退貨

跑步

public void run (TestInformation testInfo, 
                ITestInvocationListener listener)

運行測試,並將結果報告給偵聽器。

參數
testInfo TestInformationTestInformation物件包含執行測試的有用資訊。

listener ITestInvocationListener :測試結果的ITestInvocationListener

投擲
DeviceNotAvailableException

設定建置

public void setBuild (IBuildInfo build)

參數
build IBuildInfo

僅設定收集測試

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

使用Ravenwood資源

public boolean useRavenwoodResources ()

退貨
boolean

使用RobolectricResources

public boolean useRobolectricResources ()

退貨
boolean

受保護的方法

編譯LdLibraryPathInner

protected String compileLdLibraryPathInner (String androidHostOut)

我們從單元測試中呼叫這個版本,並直接傳遞ANDROID_HOST_OUT。我們需要它是因為Java沒有API來設定環境變數。

參數
androidHostOut String

退貨
String

取得Jar文件

protected File getJarFile (String jarName, 
                TestInformation testInfo)

從 HostTest 複製來模仿其單元測試利用。

檢查不同用例中工件通常所在的幾個位置以找到我們的 jar。

參數
jarName String

testInfo TestInformation

退貨
File

設定伺服器

protected void setServer (ServerSocket server)

參數
server ServerSocket