隔離されたホストテスト

public class IsolatedHostTest
extends Object implements IRemoteTest , IBuildReceiver , ITestAnnotationFilterReceiver , ITestFilterReceiver , IConfigurationReceiver , ITestCollector

java.lang.オブジェクト
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 ()

パブリックメソッド

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

クリア注釈の除外

public void clearExcludeAnnotations ()

現在追跡されているすべての除外注釈を削除します。

クリア除外フィルター

public void clearExcludeFilters ()

現在追跡されているすべての除外フィルターを削除します。

アノテーションを含めるクリア

public void clearIncludeAnnotations ()

現在追跡されているすべてのインクルードアノテーションを削除します。

ClearIncludeFilters

public void clearIncludeFilters ()

現在追跡されているすべての組み込みフィルターを削除します。

コンパイルクラスパス

public String compileClassPath ()

テストを実行するために必要な jar を含むサブプロセスのクラスパスを作成します。

戻り値
Stringコロンで区切られたクラスパスを指定する文字列。

コンパイルコマンド引数

public  compileCommandArgs (String classpath, 
                File artifactsDir)

サブプロセス ランナーを実行するためのコマンド引数を組み立てます。

パラメーター
classpath String

artifactsDir File

戻り値

削除TempFiles

public void deleteTempFiles ()

getCoverageExecFile

public File getCoverageExecFile ()

戻り値
File

getExcludeAnnotations

public  getExcludeAnnotations ()

除外する注釈の現在のERROR(/Set)を返します。

戻り値

getExcludeFilters

public  getExcludeFilters ()

除外フィルターの現在のERROR(/Set)を返します。

戻り値

getIncludeAnnotations

public  getIncludeAnnotations ()

含める注釈の現在のERROR(/Set)を返します。

戻り値

getIncludeFilters

public  getIncludeFilters ()

インクルードフィルターの現在のERROR(/Set)を返します。

戻り値

走る

public void run (TestInformation testInfo, 
                ITestInvocationListener listener)

テストを実行し、結果をリスナーに報告します。

パラメーター
testInfo TestInformation : テストを実行するために役立つ情報を含むTestInformationオブジェクト。

listener ITestInvocationListener : テスト結果のITestInvocationListener

投げる
DeviceNotAvailableException

setBuild

public void setBuild (IBuildInfo build)

パラメーター
build IBuildInfo

setCollectTestsOnly

public void setCollectTestsOnly (boolean shouldCollectTest)

テスト収集モードを有効または無効にします。

set構成

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

useRavenwoodリソース

public boolean useRavenwoodResources ()

戻り値
boolean

useRobolectricResources

public boolean useRobolectricResources ()

戻り値
boolean

保護されたメソッド

コンパイルLdLibraryPathInner

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

セットサーバー

protected void setServer (ServerSocket server)

パラメーター
server ServerSocket