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(Set<String> notAnnotations)
テストにマークされている場合に除外するアノテーションの |
void
|
addAllExcludeFilters(Set<String> filters)
除外するテストのフィルタの |
void
|
addAllIncludeAnnotation(Set<String> annotations)
テストがマークされている場合に含めるアノテーションの |
void
|
addAllIncludeFilters(Set<String> 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()
現在トラッキングされているすべての包含フィルタを削除します。 |
String
|
compileClassPath()
テストの実行に必要な jar を含むサブプロセスのクラスパスを作成します。 |
List<String>
|
compileCommandArgs(String classpath, File artifactsDir)
サブプロセス ランナーを実行するコマンド引数を組み立てます。 |
void
|
deleteTempFiles()
|
File
|
getCoverageExecFile()
|
Set<String>
|
getExcludeAnnotations()
除外するアノテーションの現在の |
Set<String>
|
getExcludeFilters()
除外フィルタの現在の |
Set<String>
|
getIncludeAnnotations()
含めるアノテーションの現在の |
Set<String>
|
getIncludeFilters()
現在のインクルード フィルタの |
void
|
run(TestInformation testInfo, ITestInvocationListener listener)
テストを実行し、結果をリスナーに報告します。 |
void
|
setBuild(IBuildInfo build)
|
void
|
setCollectTestsOnly(boolean shouldCollectTest)
テスト収集モードを有効または無効にします。 |
void
|
setConfiguration(IConfiguration configuration)
使用中の |
void
|
setDebug(boolean debug)
|
Collection<IRemoteTest>
|
split(int shardCount)
実行しようとした shardCount も提供する |
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 (Set<String> notAnnotations)
テストにマークされている場合に除外するアノテーションの Set を追加します。
| パラメータ | |
|---|---|
notAnnotations |
Set |
addAllExcludeFilters
public void addAllExcludeFilters (Set<String> filters)
除外するテストのフィルタの Set を追加します。
| パラメータ | |
|---|---|
filters |
Set |
addAllIncludeAnnotation
public void addAllIncludeAnnotation (Set<String> annotations)
テストがマークされている場合に含めるアノテーションの Set を追加します。
| パラメータ | |
|---|---|
annotations |
Set |
addAllIncludeFilters
public void addAllIncludeFilters (Set<String> filters)
テストに含めるフィルタの Set を追加します。
| パラメータ | |
|---|---|
filters |
Set |
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 List<String> compileCommandArgs (String classpath,
File artifactsDir)サブプロセス ランナーを実行するコマンド引数を組み立てます。
| パラメータ | |
|---|---|
classpath |
String |
artifactsDir |
File |
| 戻り値 | |
|---|---|
List<String> |
|
deleteTempFiles
public void deleteTempFiles ()
getCoverageExecFile
public File getCoverageExecFile ()
| 戻り値 | |
|---|---|
File |
|
getExcludeAnnotations
public Set<String> getExcludeAnnotations ()
除外するアノテーションの現在の Set を返します。
| 戻り値 | |
|---|---|
Set<String> |
|
getIncludeAnnotations
public Set<String> getIncludeAnnotations ()
含めるアノテーションの現在の Set を返します。
| 戻り値 | |
|---|---|
Set<String> |
|
getIncludeFilters
public Set<String> getIncludeFilters ()
インクルード フィルタの現在の Set を返します。
| 戻り値 | |
|---|---|
Set<String> |
|
run
public void run (TestInformation testInfo, ITestInvocationListener listener)
テストを実行し、結果をリスナーに報告します。
| パラメータ | |
|---|---|
testInfo |
TestInformation: テストの実行に役立つ情報を含む TestInformation オブジェクト。 |
listener |
ITestInvocationListener: テスト結果の ITestInvocationListener |
| 例外 | |
|---|---|
DeviceNotAvailableException |
|
setCollectTestsOnly
public void setCollectTestsOnly (boolean shouldCollectTest)
テスト収集モードを有効または無効にします
setConfiguration
public void setConfiguration (IConfiguration configuration)
使用中の IConfiguration を挿入します。
| パラメータ | |
|---|---|
configuration |
IConfiguration |
setDebug
public void setDebug (boolean debug)
| パラメータ | |
|---|---|
debug |
boolean |
split
public Collection<IRemoteTest> split (int shardCount)
実行しようとした shardCount も提供する split() の代替バージョン。これは、テストランナーが任意に決定できない場合に便利です。
| パラメータ | |
|---|---|
shardCount |
int: 試行されたシャード数。 |
| 戻り値 | |
|---|---|
Collection<IRemoteTest> |
個別に実行されるサブテストのコレクション。テストが現在シャード可能でない場合は 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 |
|
| 例外 | |
|---|---|
FileNotFoundException |
|
setServer
protected void setServer (ServerSocket server)
| パラメータ | |
|---|---|
server |
ServerSocket |