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

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

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

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