IsolatedHostTest

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

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


Implementuje moduł uruchamiający TradeFed, który używa podprocesu do wykonywania testów w środowisku o niskiej zależności zamiast wykonywać je w procesie głównym.

Ten program uruchamiający zakłada, że wszystkie skonfigurowane pliki JAR znajdują się w tym samym katalogu testowym, i uruchamia podproces w tym katalogu. Musiał wybrać katalog roboczy dla podprocesu, a wiele testów korzysta z tego, że jest to katalog testowy. Dlatego było to najlepsze dostępne rozwiązanie.

Podsumowanie

Konstruktory publiczne

IsolatedHostTest()

Metody publiczne

void addAllExcludeAnnotation(Set<String> notAnnotations)

Dodaje Set adnotacji do wykluczenia, jeśli test jest oznaczony tym symbolem.

void addAllExcludeFilters(Set<String> filters)

Dodaje Set filtrów określających, które testy mają zostać wykluczone.

void addAllIncludeAnnotation(Set<String> annotations)

Dodaje Set adnotacji do uwzględnienia, jeśli test jest oznaczony tym symbolem.

void addAllIncludeFilters(Set<String> filters)

Dodaje Set filtrów, które określają, jakie testy mają być uwzględnione.

void addExcludeAnnotation(String notAnnotation)

Dodaje adnotację do wykluczenia, jeśli testy są nią oznaczone.

void addExcludeFilter(String filter)

Dodaje filtr określający, które testy mają zostać wykluczone.

void addIncludeAnnotation(String annotation)

Dodaje adnotację, która ma być uwzględniana, jeśli test jest nią oznaczony.

void addIncludeFilter(String filter)

Dodaje filtr określający, które testy mają być uwzględnione.

void clearExcludeAnnotations()

Usuń wszystkie aktualnie śledzone adnotacje wykluczeń.

void clearExcludeFilters()

Usuń wszystkie obecnie śledzone filtry wykluczeń.

void clearIncludeAnnotations()

Usuń wszystkie obecnie śledzone adnotacje dotyczące uwzględniania.

void clearIncludeFilters()

Usuń wszystkie obecnie śledzone filtry uwzględniania.

String compileClassPath()

Tworzy ścieżkę klas dla podprocesu, która zawiera pliki JAR niezbędne do uruchomienia testów.

List<String> compileCommandArgs(String classpath, File artifactsDir)

Tworzy argumenty polecenia, aby wykonać program uruchamiający podproces.

void deleteTempFiles()
File getCoverageExecFile()
Set<String> getExcludeAnnotations()

Zwraca bieżący Set adnotacji do wykluczenia.

Set<String> getExcludeFilters()

Zwraca bieżącą Set filtrów wykluczeń.

Set<String> getIncludeAnnotations()

Zwraca bieżącą Set adnotacji do uwzględnienia.

Set<String> getIncludeFilters()

Zwraca bieżącą Set filtrów uwzględniania.

void run(TestInformation testInfo, ITestInvocationListener listener)

Przeprowadza testy i przekazuje wyniki odbiorcy.

void setBuild(IBuildInfo build)

void setCollectTestsOnly(boolean shouldCollectTest)

Włącza lub wyłącza tryb zbierania testów

void setConfiguration(IConfiguration configuration)

Wstawia używaną wartość IConfiguration.

void setDebug(boolean debug)
Collection<IRemoteTest> split(int shardCount)

Alternatywna wersja split(), która podaje też liczbę fragmentów, które mają zostać uruchomione.

void uploadTestArtifacts(File logDir, ITestInvocationListener listener)
boolean useRavenwoodResources()
boolean useRobolectricResources()

Metody chronione

String compileLdLibraryPathInner(String androidHostOut)

Wywołujemy tę wersję z testu jednostkowego i bezpośrednio przekazujemy ANDROID_HOST_OUT.

File getJarFile(String jarName, TestInformation testInfo)

Skopiowano z HostTest, aby naśladować jego test jednostkowy.

void setServer(ServerSocket server)

Konstruktory publiczne

IsolatedHostTest

public IsolatedHostTest ()

Metody publiczne

addAllExcludeAnnotation

public void addAllExcludeAnnotation (Set<String> notAnnotations)

Dodaje Set adnotacji do wykluczenia, jeśli test jest oznaczony tym symbolem.

Parametry
notAnnotations Set

addAllExcludeFilters

public void addAllExcludeFilters (Set<String> filters)

Dodaje Set filtrów określających, które testy mają zostać wykluczone.

Parametry
filters Set

addAllIncludeAnnotation

public void addAllIncludeAnnotation (Set<String> annotations)

Dodaje Set adnotacji do uwzględnienia, jeśli test jest oznaczony tym symbolem.

Parametry
annotations Set

addAllIncludeFilters

public void addAllIncludeFilters (Set<String> filters)

Dodaje Set filtrów, które określają, jakie testy mają być uwzględnione.

Parametry
filters Set

addExcludeAnnotation

public void addExcludeAnnotation (String notAnnotation)

Dodaje adnotację do wykluczenia, jeśli testy są nią oznaczone.

Parametry
notAnnotation String

addExcludeFilter

public void addExcludeFilter (String filter)

Dodaje filtr określający, które testy mają zostać wykluczone.

Parametry
filter String

addIncludeAnnotation

public void addIncludeAnnotation (String annotation)

Dodaje adnotację, która ma być uwzględniana, jeśli test jest nią oznaczony.

Parametry
annotation String

addIncludeFilter

public void addIncludeFilter (String filter)

Dodaje filtr określający, które testy mają być uwzględnione.

Parametry
filter String

clearExcludeAnnotations

public void clearExcludeAnnotations ()

Usuń wszystkie aktualnie śledzone adnotacje wykluczeń.

clearExcludeFilters

public void clearExcludeFilters ()

Usuń wszystkie obecnie śledzone filtry wykluczeń.

clearIncludeAnnotations

public void clearIncludeAnnotations ()

Usuń wszystkie obecnie śledzone adnotacje dotyczące uwzględniania.

clearIncludeFilters

public void clearIncludeFilters ()

Usuń wszystkie obecnie śledzone filtry uwzględniania.

compileClassPath

public String compileClassPath ()

Tworzy ścieżkę klas dla podprocesu, która zawiera pliki JAR niezbędne do uruchomienia testów.

Zwraca
String ciąg znaków określający ścieżkę klasy rozdzieloną dwukropkami.

compileCommandArgs

public List<String> compileCommandArgs (String classpath, 
                File artifactsDir)

Tworzy argumenty polecenia, aby wykonać program uruchamiający proces podrzędny.

Parametry
classpath String

artifactsDir File

Zwraca
List<String>

deleteTempFiles

public void deleteTempFiles ()

getCoverageExecFile

public File getCoverageExecFile ()

Zwraca
File

getExcludeAnnotations

public Set<String> getExcludeAnnotations ()

Zwraca bieżący Set adnotacji do wykluczenia.

Zwraca
Set<String>

getExcludeFilters

public Set<String> getExcludeFilters ()

Zwraca bieżącą Set filtrów wykluczeń.

Zwraca
Set<String>

getIncludeAnnotations

public Set<String> getIncludeAnnotations ()

Zwraca bieżącą Set adnotacji do uwzględnienia.

Zwraca
Set<String>

getIncludeFilters

public Set<String> getIncludeFilters ()

Zwraca bieżącą Set filtrów uwzględniania.

Zwraca
Set<String>

home run

public void run (TestInformation testInfo, 
                ITestInvocationListener listener)

Przeprowadza testy i przekazuje wyniki odbiorcy.

Parametry
testInfo TestInformation: obiekt TestInformation zawierający przydatne informacje do przeprowadzania testów.

listener ITestInvocationListener: ITestInvocationListener wyników testu

Zgłasza
DeviceNotAvailableException

setBuild

public void setBuild (IBuildInfo build)

Parametry
build IBuildInfo

setCollectTestsOnly

public void setCollectTestsOnly (boolean shouldCollectTest)

Włącza lub wyłącza tryb zbierania testów

setConfiguration

public void setConfiguration (IConfiguration configuration)

Wstawia używaną wartość IConfiguration.

Parametry
configuration IConfiguration

setDebug

public void setDebug (boolean debug)

Parametry
debug boolean

podziel

public Collection<IRemoteTest> split (int shardCount)

Alternatywna wersja split(), która podaje też liczbę fragmentów, które mają zostać uruchomione. Jest to przydatne w przypadku niektórych programów do uruchamiania testów, które nie mogą czasami podejmować arbitralnych decyzji.

Parametry
shardCount int: liczba fragmentów, których utworzenie zostało podjęte.

Zwraca
Collection<IRemoteTest> zbiór podtestów do wykonania osobno lub null, jeśli test nie jest obecnie podzielony na części.

uploadTestArtifacts

public void uploadTestArtifacts (File logDir, 
                ITestInvocationListener listener)

Parametry
logDir File

listener ITestInvocationListener

useRavenwoodResources

public boolean useRavenwoodResources ()

Zwraca
boolean

useRobolectricResources

public boolean useRobolectricResources ()

Zwraca
boolean

Metody chronione

compileLdLibraryPathInner

protected String compileLdLibraryPathInner (String androidHostOut)

Wywołujemy tę wersję z testu jednostkowego i bezpośrednio przekazujemy ANDROID_HOST_OUT. Jest nam potrzebny, ponieważ w języku Java nie ma interfejsu API do ustawiania zmiennych środowiskowych.

Parametry
androidHostOut String

Zwraca
String

getJarFile

protected File getJarFile (String jarName, 
                TestInformation testInfo)

Skopiowano z HostTest, aby naśladować jego test jednostkowy.

Sprawdź kilka lokalizacji, w których zwykle znajdują się artefakty w różnych przypadkach użycia, aby znaleźć plik JAR.

Parametry
jarName String

testInfo TestInformation

Zwraca
File

Zgłasza
FileNotFoundException

setServer

protected void setServer (ServerSocket server)

Parametry
server ServerSocket