IsolatedHostTest

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

java.lang.Object
   ↳ com.android.tradefed.testtype.IsolatedHostTest


サブプロセスを使用して、メイン プロセスでテストを実行する代わりに、依存性の低い環境でテストを実行する TradeFed ランナーを実装します。

このランナーは、構成されたすべての jar が同じテスト ディレクトリにあることを前提として、そのディレクトリでサブプロセスを起動します。サブプロセスの作業ディレクトリを選択する必要があり、多くのテストでそのディレクトリがテスト ディレクトリであるとメリットがあるため、これが最善の妥協案でした。

概要

パブリック コンストラクタ

IsolatedHostTest()

パブリック メソッド

void addAllExcludeAnnotation( notAnnotations)

テストにマークされている場合に除外するアノテーションの ERROR(/Set) を追加します。

void addAllExcludeFilters( filters)

除外するテストのフィルタの ERROR(/Set) を追加します。

void addAllIncludeAnnotation( annotations)

テストにマークが付いている場合に含めるアノテーションの ERROR(/Set) を追加します。

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

現在トラッキングされているすべての include アノテーションを削除します。

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)
split(int shardCount)

実行しようとした shardCount も提供する split() の代替バージョン。

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

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

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

compileCommandArgs

public  compileCommandArgs (String classpath, 
                File artifactsDir)

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

パラメータ
classpath String

artifactsDir File

戻り値

deleteTempFiles

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)

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

setConfiguration

public void setConfiguration (IConfiguration configuration)

使用中の IConfiguration を挿入します。

パラメータ
configuration IConfiguration

setDebug

public void setDebug (boolean debug)

パラメータ
debug boolean

分割

public  split (int shardCount)

実行しようとした shardCount も提供する split() の代替バージョン。これは、任意に決定できないテストランナーに役立ちます。

パラメータ
shardCount int: 試行されたシャード数。

戻り値
個別に実行されるサブテストのコレクション。テストが現在シャード可能でない場合は null

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