Test hosta
public class HostTest
extends Object
implements IDeviceTest , ITestFilterReceiver , ITestAnnotationFilterReceiver , IRemoteTest , ITestCollector , IBuildReceiver , IAbiReceiver , IShardableTest , IRuntimeHintProvider , IConfigurationReceiver
Obiekt Java.lang.Object | |
↳ | com.android.tradefed.testtype.HostTest |
Program uruchamiający testy oparte na hoście JUnit. Jeśli test, który ma zostać uruchomiony, implementuje IDeviceTest
ten moduł uruchamiający przekaże odniesienie do urządzenia.
Streszczenie
Pola | |
---|---|
public static final String | SET_OPTION_DESC |
public static final String | SET_OPTION_NAME
|
Konstruktorzy publiczni | |
---|---|
HostTest () |
Metody publiczne | |
---|---|
void | addAllExcludeAnnotation ( notAnnotations) addAllExcludeAnnotation ( notAnnotations) Dodaje |
void | addAllExcludeFilters ( filters) addAllExcludeFilters ( filters) Dodaje |
void | addAllIncludeAnnotation ( annotations) addAllIncludeAnnotation ( annotations) Dodaje |
void | addAllIncludeFilters ( filters) addAllIncludeFilters ( filters) Dodaje |
void | addExcludeAnnotation (String notAnnotation) Dodaje adnotację wykluczającą test, jeśli jest nią oznaczony. |
void | addExcludeFilter (String filter) Dodaje filtr określający, które testy należy wykluczyć. |
void | addIncludeAnnotation (String annotation) Dodaje adnotację, którą należy uwzględnić, jeśli test jest nią oznaczony. |
void | addIncludeFilter (String filter) Dodaje filtr określający, które testy należy uwzględnić. |
void | clearExcludeAnnotations () Usuń wszystkie aktualnie śledzone adnotacje wykluczające. |
void | clearExcludeFilters () Usuń wszystkie aktualnie śledzone filtry wykluczeń. |
void | clearIncludeAnnotations () Usuń wszystkie aktualnie śledzone adnotacje dołączania. |
void | clearIncludeFilters () Usuń wszystkie aktualnie śledzone filtry uwzględniania. |
int | countTestCases () Zwróć liczbę przypadków testowych we wszystkich klasach wchodzących w skład testów |
IAbi | getAbi () |
getClassNames () | |
ITestDevice | getDevice () Oddaj urządzenie do testu. |
getExcludeAnnotations () Zwraca bieżący | |
getExcludeFilters () Zwraca bieżący | |
getIncludeAnnotations () Zwraca bieżący | |
getIncludeFilters () Zwraca bieżący | |
long | getRuntimeHint () Zwróć oczekiwany czas wykonania testu w milisekundach. |
void | run ( TestInformation testInfo, ITestInvocationListener listener) Uruchamia testy i raportuje wyniki słuchaczowi. |
void | setAbi ( IAbi abi) |
void | setBuild ( IBuildInfo buildInfo) |
void | setCollectTestsOnly (boolean shouldCollectTest) Włącza lub wyłącza tryb zbierania testów |
void | setConfiguration ( IConfiguration configuration) Wstrzykuje używaną |
void | setDevice ( ITestDevice device) Wstrzyknij testowane urządzenie. |
static void | setOptionToLoadedObject (Object testObj, keyValueOptions) setOptionToLoadedObject (Object testObj, keyValueOptions) Pomocnik dla modułów uruchamiających urządzenia do ustawiania opcji w taki sam sposób jak HostTest, z opcji set-option. |
void | setTestInformation ( TestInformation testInfo) |
split (Integer shardCount, TestInformation testInfo) Dzielimy według poszczególnych klas testowych lub metod. |
Metody chronione | |
---|---|
HostTest | createHostTest (Class<?> classObj) Pomocnik do tworzenia instancji HostTest podczas fragmentowania. |
IBuildInfo | getBuild () Uzyskaj informacje o kompilacji otrzymane przez HostTest. |
ClassLoader | getClassLoader () Zwraca domyślny moduł ładujący klasy. |
final | getClasses () |
File | getJarFile (String jarName, TestInformation testInfo) Sprawdź kilka lokalizacji, w których zwykle znajdują się artefakty, pod kątem różnych zastosowań, aby znaleźć nasz słoik. |
boolean | hasJUnit4Annotation (Class<?> classObj) Pomocnik w ustaleniu czy mamy do czynienia z klasą Test z adnotacjami Junit4. |
Object | loadObject (Class<?> classObj) załaduj obiekt klasy i ustaw informacje testowe (urządzenie, kompilacja). |
void | setClassName (String className) Wyczyść, a następnie ustaw nazwę klasy, która ma zostać uruchomiona. |
boolean | shouldTestRun (AnnotatedElement annotatedElement) Sprawdź, czy elementy posiadające adnotację przechodzą przez filtr. |
Pola
SET_OPTION_DESC
public static final String SET_OPTION_DESC
SET_OPTION_NAME
public static final String SET_OPTION_NAME
Konstruktorzy publiczni
Test hosta
public HostTest ()
Metody publiczne
addAllExcludeAdnotacja
public void addAllExcludeAnnotation (notAnnotations)
Dodaje ERROR(/Set)
adnotacji do wykluczenia, jeśli test jest nim oznaczony.
Parametry | |
---|---|
notAnnotations |
addAllExcludeFilters
public void addAllExcludeFilters (filters)
Dodaje ERROR(/Set)
filtrów, z których testy mają zostać wykluczone.
Parametry | |
---|---|
filters |
addAllIncludeAdnotacja
public void addAllIncludeAnnotation (annotations)
Dodaje ERROR(/Set)
adnotacji do uwzględnienia w testach, jeśli są nim oznaczone.
Parametry | |
---|---|
annotations |
dodajAllIncludeFilters
public void addAllIncludeFilters (filters)
Dodaje ERROR(/Set)
filtrów, które należy uwzględnić w testach.
Parametry | |
---|---|
filters |
dodajWykluczAdnotację
public void addExcludeAnnotation (String notAnnotation)
Dodaje adnotację wykluczającą test, jeśli jest nią oznaczony.
Parametry | |
---|---|
notAnnotation | String |
dodajWykluczFiltr
public void addExcludeFilter (String filter)
Dodaje filtr określający, które testy należy wykluczyć.
Parametry | |
---|---|
filter | String |
dodajIncludeAdnotację
public void addIncludeAnnotation (String annotation)
Dodaje adnotację, którą należy uwzględnić, jeśli test jest nią oznaczony.
Parametry | |
---|---|
annotation | String |
dodajIncludeFilter
public void addIncludeFilter (String filter)
Dodaje filtr określający, które testy należy uwzględnić.
Parametry | |
---|---|
filter | String |
wyczyśćWykluczAdnotacje
public void clearExcludeAnnotations ()
Usuń wszystkie aktualnie śledzone adnotacje wykluczające.
wyczyśćWykluczFiltry
public void clearExcludeFilters ()
Usuń wszystkie aktualnie śledzone filtry wykluczeń.
wyczyśćDołączAdnotacje
public void clearIncludeAnnotations ()
Usuń wszystkie aktualnie śledzone adnotacje dołączania.
wyczyśćIncludeFilters
public void clearIncludeFilters ()
Usuń wszystkie aktualnie śledzone filtry uwzględniania.
liczba przypadków testowych
public int countTestCases ()
Zwróć liczbę przypadków testowych we wszystkich klasach wchodzących w skład testów
Zwroty | |
---|---|
int |
pobierzNazwyKlasy
publicgetClassNames ()
Zwroty | |
---|---|
pobierz urządzenie
public ITestDevice getDevice ()
Oddaj urządzenie do testu.
Zwroty | |
---|---|
ITestDevice | ITestDevice |
pobierzWykluczAdnotacje
publicgetExcludeAnnotations ()
Zwraca bieżący ERROR(/Set)
adnotacji do wykluczenia.
Zwroty | |
---|---|
pobierzIncludeAnnotations
publicgetIncludeAnnotations ()
Zwraca bieżący ERROR(/Set)
adnotacji do uwzględnienia.
Zwroty | |
---|---|
pobierzIncludeFilters
publicgetIncludeFilters ()
Zwraca bieżący ERROR(/Set)
filtrów dołączanych.
Zwroty | |
---|---|
pobierz wskazówkę uruchomieniową
public long getRuntimeHint ()
Zwróć oczekiwany czas wykonania testu w milisekundach. Czas jest używany do zrównoważenia obciążenia wykonania podzielonego na fragmenty
Zwroty | |
---|---|
long |
uruchomić
public void run (TestInformation testInfo, ITestInvocationListener listener)
Uruchamia testy i raportuje wyniki słuchaczowi.
Parametry | |
---|---|
testInfo | TestInformation : Obiekt TestInformation zawierający informacje przydatne do uruchamiania testów. |
listener | ITestInvocationListener : ITestInvocationListener wyników testów |
Rzuca | |
---|---|
DeviceNotAvailableException |
setCollectTestsOnly
public void setCollectTestsOnly (boolean shouldCollectTest)
Włącza lub wyłącza tryb zbierania testów
ustaw konfigurację
public void setConfiguration (IConfiguration configuration)
Wstrzykuje używaną IConfiguration
.
Parametry | |
---|---|
configuration | IConfiguration |
ustaw urządzenie
public void setDevice (ITestDevice device)
Wstrzyknij testowane urządzenie.
Parametry | |
---|---|
device | ITestDevice : ITestDevice do użycia |
setOptionToLoadedObject
public static void setOptionToLoadedObject (Object testObj,keyValueOptions)
Pomocnik dla modułów uruchamiających urządzenia do ustawiania opcji w taki sam sposób jak HostTest, z opcji set-option.
Parametry | |
---|---|
testObj | Object : obiekt, który otrzyma opcje. |
keyValueOptions |
zestaw informacji testowych
public void setTestInformation (TestInformation testInfo)
Parametry | |
---|---|
testInfo | TestInformation |
podział
publicsplit (Integer shardCount, TestInformation testInfo)
Dzielimy według poszczególnych klas testowych lub metod.
Parametry | |
---|---|
shardCount | Liczba Integer : liczba próbnych fragmentów. |
testInfo | TestInformation : nadrzędna TestInformation |
Zwroty | |
---|---|
zbiór podtestów, które mają być wykonane osobno lub mają wartość null , jeśli testu nie można obecnie podzielić |
Metody chronione
utwórz test hosta
protected HostTest createHostTest (Class<?> classObj)
Pomocnik do tworzenia instancji HostTest podczas fragmentowania. Zastąp, aby zwrócić dowolne dziecko z HostTest.
Parametry | |
---|---|
classObj | Class |
Zwroty | |
---|---|
HostTest |
getBuild
protected IBuildInfo getBuild ()
Uzyskaj informacje o kompilacji otrzymane przez HostTest.
Zwroty | |
---|---|
IBuildInfo | IBuildInfo |
pobierzClassLoader
protected ClassLoader getClassLoader ()
Zwraca domyślny moduł ładujący klasy.
Zwroty | |
---|---|
ClassLoader |
pobierzKlasy
protected finalgetClasses ()
Zwroty | |
---|---|
pobierz plik Jar
protected File getJarFile (String jarName, TestInformation testInfo)
Sprawdź kilka lokalizacji, w których zwykle znajdują się artefakty, pod kątem różnych zastosowań, aby znaleźć nasz słoik.
Parametry | |
---|---|
jarName | String |
testInfo | TestInformation |
Zwroty | |
---|---|
File |
maJUnit4Adnotacja
protected boolean hasJUnit4Annotation (Class<?> classObj)
Pomocnik w ustaleniu czy mamy do czynienia z klasą Test z adnotacjami Junit4.
Parametry | |
---|---|
classObj | Class |
Zwroty | |
---|---|
boolean |
załaduj obiekt
protected Object loadObject (Class<?> classObj)
załaduj obiekt klasy i ustaw informacje testowe (urządzenie, kompilacja).
Parametry | |
---|---|
classObj | Class |
Zwroty | |
---|---|
Object |
nazwa_klasy zestawu
protected void setClassName (String className)
Wyczyść, a następnie ustaw nazwę klasy, która ma zostać uruchomiona.
Parametry | |
---|---|
className | String |
powinienTestRun
protected boolean shouldTestRun (AnnotatedElement annotatedElement)
Sprawdź, czy elementy posiadające adnotację przechodzą przez filtr. Wystawiony do testów jednostkowych.
Zwroty | |
---|---|
boolean | false, jeśli test nie powinien zostać uruchomiony. |