HostTest
public
class
HostTest
extends Object
implements
IAbiReceiver,
IBuildReceiver,
IConfigurationReceiver,
IDeviceTest,
IDiscoverTestClasses,
IRemoteTest,
IRuntimeHintProvider,
IShardableTest,
ITestAnnotationFilterReceiver,
ITestCollector,
ITestFilterReceiver
| java.lang.Object | |
| ↳ | com.android.tradefed.testtype.HostTest |
Uruchamiający testy oparte na hostach JUnit. Jeśli test, który ma być uruchomiony, implementuje IDeviceTest, ten program wykonawczy przekaże odwołanie do urządzenia.
Podsumowanie
Fieldsem | |
|---|---|
public
static
final
String |
SET_OPTION_DESC
|
public
static
final
String |
SET_OPTION_NAME
|
Konstruktory publiczne | |
|---|---|
HostTest()
|
|
Metody publiczne | |
|---|---|
void
|
addAllExcludeAnnotation(
Dodaje adnotacje |
void
|
addAllExcludeFilters(
Dodaje |
void
|
addAllIncludeAnnotation(
Dodaje adnotacje |
void
|
addAllIncludeFilters(
Dodaje |
void
|
addExcludeAnnotation(String notAnnotation)
Dodaje adnotację do wykluczenia, jeśli testy są oznaczone. |
void
|
addExcludeFilter(String filter)
Dodaje filtr, który określa, które testy mają być wykluczone. |
void
|
addIncludeAnnotation(String annotation)
Dodaje adnotację, która zostanie uwzględniona, jeśli testy są oznaczone. |
void
|
addIncludeFilter(String filter)
Dodaje filtr określający, które testy mają być uwzględnione. |
void
|
clearExcludeAnnotations()
usunąć wszystkie adnotacje wykluczeń, które są obecnie śledzone; |
void
|
clearExcludeFilters()
usunąć wszystkie filtry wykluczeń, które są obecnie śledzone; |
void
|
clearIncludeAnnotations()
usunąć wszystkie adnotacje uwzględnienia, które są obecnie śledzone; |
void
|
clearIncludeFilters()
Usuń wszystkie filtry uwzględniania, które są obecnie śledzone. |
int
|
countTestCases()
Zwraca liczbę przypadków testowych we wszystkich klasach, które są częścią testów |
IAbi
|
getAbi()
|
|
getClassNames()
|
ITestDevice
|
getDevice()
Przygotuj urządzenie do testowania. |
|
getExcludeAnnotations()
Zwraca bieżącą |
|
getExcludeFilters()
Zwraca bieżącą |
|
getIncludeAnnotations()
Zwraca bieżącą |
|
getIncludeFilters()
Zwraca bieżącą wartość |
long
|
getRuntimeHint()
Zwraca oczekiwany czas działania testu w milisekundach. |
void
|
run(TestInformation testInfo, ITestInvocationListener listener)
Przeprowadza testy i przekazuje wyniki do odbiorcy. |
void
|
setAbi(IAbi abi)
|
void
|
setBuild(IBuildInfo buildInfo)
|
void
|
setCollectTestsOnly(boolean shouldCollectTest)
Włącza lub wyłącza tryb testowy zbierania danych |
void
|
setConfiguration(IConfiguration configuration)
Wstrzykuje |
void
|
setDevice(ITestDevice device)
Wstrzyknij urządzenie testowe. |
static
void
|
setOptionToLoadedObject(Object testObj,
Pomocnik dla testujących urządzenia, który służy do ustawiania opcji w taki sam sposób jak HostTest, za pomocą polecenia set-option. |
void
|
setTestInformation(TestInformation testInfo)
|
|
split(Integer shardCount, TestInformation testInfo)
Podział na poszczególne osoby odbywa się według klasy testu lub metody. |
Chronione metody | |
|---|---|
HostTest
|
createHostTest(Class<?> classObj)
Pomoc do tworzenia instancji HostTest podczas dzielenia. |
IBuildInfo
|
getBuild()
Uzyskaj informacje o kompilacji otrzymane przez HostTest. |
ClassLoader
|
getClassLoader()
Zwraca domyślny ładownik klas. |
final
|
getClasses()
|
File
|
getJarFile(String jarName, TestInformation testInfo)
Aby znaleźć plik jar, sprawdź kilka lokalizacji, w których zwykle znajdują się artefakty. |
boolean
|
hasJUnit4Annotation(Class<?> classObj)
Pomocnik do określania, czy mamy do czynienia z klasą Test z adnotacjami Junit4. |
Object
|
loadObject(Class<?> classObj)
wczytać obiekt klasy i ustawiać informacje o teście (urządzenie, kompilacja). |
void
|
setClassName(String className)
Wyczyść, a następnie ustaw nazwę klasy, która ma być uruchomiona. |
boolean
|
shouldTestRun(AnnotatedElement annotatedElement)
Sprawdzanie, czy elementy z adnotacjami przechodzą przez filtr. |
Fieldsem
SET_OPTION_DESC
public static final String SET_OPTION_DESC
SET_OPTION_NAME
public static final String SET_OPTION_NAME
Konstruktory publiczne
HostTest
public HostTest ()
Metody publiczne
addAllExcludeAnnotation
public void addAllExcludeAnnotation (notAnnotations)
Dodaje adnotacje ERROR(/Set) do wykluczenia, jeśli testy są oznaczone.
| Parametry | |
|---|---|
notAnnotations |
|
addAllExcludeFilters
public void addAllExcludeFilters (filters)
Dodaje ERROR(/Set) filtrów, które testy mają być wykluczone.
| Parametry | |
|---|---|
filters |
|
addAllIncludeAnnotation
public void addAllIncludeAnnotation (annotations)
Dodaje adnotacje ERROR(/Set) do uwzględnienia, jeśli testy są oznaczone.
| Parametry | |
|---|---|
annotations |
|
addAllIncludeFilters
public void addAllIncludeFilters (filters)
Dodaje ERROR(/Set) filtrów, których testy mają być uwzględnione.
| Parametry | |
|---|---|
filters |
|
addExcludeAnnotation
public void addExcludeAnnotation (String notAnnotation)
Dodaje adnotację do wykluczenia, jeśli testy są oznaczone.
| Parametry | |
|---|---|
notAnnotation |
String |
addExcludeFilter
public void addExcludeFilter (String filter)
Dodaje filtr, który określa, które testy mają być wykluczone.
| Parametry | |
|---|---|
filter |
String |
addIncludeAnnotation
public void addIncludeAnnotation (String annotation)
Dodaje adnotację, która zostanie uwzględniona, jeśli testy są oznaczone.
| 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 ()
usunąć wszystkie adnotacje wykluczeń, które są obecnie śledzone;
clearExcludeFilters
public void clearExcludeFilters ()
usunąć wszystkie filtry wykluczeń, które są obecnie śledzone;
clearIncludeAnnotations
public void clearIncludeAnnotations ()
usunąć wszystkie adnotacje uwzględnienia, które są obecnie śledzone;
clearIncludeFilters
public void clearIncludeFilters ()
Usuń wszystkie filtry uwzględniania, które są obecnie śledzone.
countTestCases
public int countTestCases ()
Zwraca liczbę przypadków testowych we wszystkich klasach, które są częścią testów
| Zwroty | |
|---|---|
int |
|
getClassNames
publicgetClassNames ()
| Zwroty | |
|---|---|
|
|
getDevice
public ITestDevice getDevice ()
Przygotuj urządzenie do testowania.
| Zwroty | |
|---|---|
ITestDevice |
ITestDevice |
getExcludeAnnotations
publicgetExcludeAnnotations ()
Zwraca bieżącą ERROR(/Set) adnotacji do wykluczenia.
| Zwroty | |
|---|---|
|
|
getIncludeAnnotations
publicgetIncludeAnnotations ()
Zwraca bieżącą ERROR(/Set) adnotacji do uwzględnienia.
| Zwroty | |
|---|---|
|
|
getIncludeFilters
publicgetIncludeFilters ()
Zwraca bieżącą wartość ERROR(/Set) filtrów uwzględniania.
| Zwroty | |
|---|---|
|
|
getRuntimeHint
public long getRuntimeHint ()
Zwraca oczekiwany czas działania testu w milisekundach. Czas jest używany do równoważenia obciążenia w ramach sekcji.
| Zwroty | |
|---|---|
long |
|
home run
public void run (TestInformation testInfo, ITestInvocationListener listener)
Przeprowadza testy i przekazuje wyniki do odbiorcy.
| Parametry | |
|---|---|
testInfo |
TestInformation: obiekt TestInformation zawierający przydatne informacje do przeprowadzania testów. |
listener |
ITestInvocationListener: ITestInvocationListener wyników testu |
| Rzuty | |
|---|---|
DeviceNotAvailableException |
|
setCollectTestsOnly
public void setCollectTestsOnly (boolean shouldCollectTest)
Włącza lub wyłącza tryb testowy zbierania danych
setConfiguration
public void setConfiguration (IConfiguration configuration)
Wstrzykuje IConfiguration w użyciu.
| Parametry | |
|---|---|
configuration |
IConfiguration |
setDevice
public void setDevice (ITestDevice device)
Wstrzyknij urządzenie testowe.
| Parametry | |
|---|---|
device |
ITestDevice: ITestDevice do użycia |
setOptionToLoadedObject
public static void setOptionToLoadedObject (Object testObj,
keyValueOptions) Pomocnik dla testujących urządzenia, który służy do ustawiania opcji w taki sam sposób jak HostTest, za pomocą polecenia set-option.
| Parametry | |
|---|---|
testObj |
Object: obiekt, który ma otrzymać opcje. |
keyValueOptions |
: lista opcji sformatowana zgodnie z wymaganiami HostTest. |
setTestInformation
public void setTestInformation (TestInformation testInfo)
| Parametry | |
|---|---|
testInfo |
TestInformation |
podziel
publicsplit (Integer shardCount, TestInformation testInfo)
Podział na poszczególne osoby odbywa się według klasy testu lub metody.
| Parametry | |
|---|---|
shardCount |
Integer: liczba prób fragmentacji. |
testInfo |
TestInformation: element nadrzędny TestInformation |
| Zwroty | |
|---|---|
|
kolekcję testów podrzędnych do wykonania osobno lub null, jeśli test nie jest obecnie podzielony na części; |
Chronione metody
createHostTest
protected HostTest createHostTest (Class<?> classObj)
Pomoc do tworzenia instancji HostTest podczas dzielenia. Zastąpienie, aby zwrócić dowolny element podrzędny z HostTest.
| Parametry | |
|---|---|
classObj |
Class |
| Zwroty | |
|---|---|
HostTest |
|
getBuild
protected IBuildInfo getBuild ()
Uzyskaj informacje o kompilacji otrzymane przez HostTest.
| Zwroty | |
|---|---|
IBuildInfo |
IBuildInfo |
getClassLoader
protected ClassLoader getClassLoader ()
Zwraca domyślny ładownik klas.
| Zwroty | |
|---|---|
ClassLoader |
|
getClasses
protected finalgetClasses ()
| Zwroty | |
|---|---|
|
|
getJarFile
protected File getJarFile (String jarName,
TestInformation testInfo)Aby znaleźć plik jar, sprawdź kilka lokalizacji, w których zwykle znajdują się artefakty.
| Parametry | |
|---|---|
jarName |
String |
testInfo |
TestInformation |
| Zwroty | |
|---|---|
File |
|
hasJUnit4Annotation
protected boolean hasJUnit4Annotation (Class<?> classObj)
Pomocnik do określania, czy mamy do czynienia z klasą Test z adnotacjami Junit4.
| Parametry | |
|---|---|
classObj |
Class |
| Zwroty | |
|---|---|
boolean |
|
loadObject
protected Object loadObject (Class<?> classObj)
wczytać obiekt klasy i ustawiać informacje o teście (urządzenie, kompilacja).
| Parametry | |
|---|---|
classObj |
Class |
| Zwroty | |
|---|---|
Object |
|
setClassName
protected void setClassName (String className)
Wyczyść, a następnie ustaw nazwę klasy, która ma być uruchomiona.
| Parametry | |
|---|---|
className |
String |
shouldTestRun
protected boolean shouldTestRun (AnnotatedElement annotatedElement)
Sprawdzanie, czy elementy z adnotacjami przechodzą przez filtr. Wyświetlane w celu testowania jednostkowego.
| Zwroty | |
|---|---|
boolean |
false, jeśli test nie powinien być wykonywany. |