CollectingTestListener
public
class
CollectingTestListener
extends Object
implements
ITestInvocationListener,
ILogSaverListener
java.lang.Object | |
↳ | com.android.tradefed.result.CollectingTestListener |
ITestInvocationListener
, który będzie zawierać wszystkie wyniki testów.
Chociaż struktury danych używane w tym obiekcie są bezpieczne dla wątków, wywołania zwrotne ITestInvocationListener
muszą być wywoływane w prawidłowej kolejności.
Podsumowanie
Konstruktory publiczne | |
---|---|
CollectingTestListener()
|
Metody publiczne | |
---|---|
IBuildInfo
|
getBuildInfo()
Ta metoda została wycofana.
polegać na |
TestRunResult
|
getCurrentRunResults()
Pobiera wyniki bieżącego testu. |
int
|
getExpectedTests()
Zwraca liczbę oczekiwanych testów. |
IInvocationContext
|
getInvocationContext()
Zwraca kontekst wywołania zgłoszonego za pomocą |
|
getMergedTestRunResults()
Zwraca złączoną kolekcję wyników wszystkich przebiegów w różnych próbach. |
IInvocationContext
|
getModuleContextForRunResult(String testRunName)
Zwraca |
MultiMap<String, LogFile>
|
getModuleLogFiles()
Zwraca kopię mapy zawierającą wszystkie pliki z rejestrowanymi zdarzeniami powiązane z modułem. |
MultiMap<String, LogFile>
|
getNonAssociatedLogFiles()
Zwraca kopię mapy zawierającą wszystkie pliki z dziennikiem, które nie są powiązane z testem ani z modułem. |
int
|
getNumAllFailedTestRuns()
Zwraca łączną liczbę uruchomień testu w stanie niepowodzenia |
int
|
getNumAllFailedTests()
Zwraca łączną liczbę testów w stanie nieudanym (uwzględniane są tylko nieudane testy, a nie błędy w założeniach). |
int
|
getNumTestsInState(TestResult.TestStatus status)
Zwraca liczbę testów w danym stanie w ramach tego uruchomienia. |
int
|
getNumTotalTests()
Zwraca łączną liczbę ukończonych testów dla wszystkich przebiegów. |
IBuildInfo
|
getPrimaryBuildInfo()
Zwraca informacje o głównej wersji, które zostały zgłoszone za pomocą |
|
getRunResults()
Ta metoda została wycofana.
Użyj |
TestRunResult
|
getTestRunAtAttempt(String testRunName, int attempt)
Zwracaj |
int
|
getTestRunAttemptCount(String testRunName)
Zwraca liczbę prób dla danej nazwy testu. |
|
getTestRunAttempts(String testRunName)
Pobiera wszystkie próby |
|
getTestRunForAttempts(int attempt)
Pobiera wszystkie wyniki dla danej próby. |
|
getTestRunNames()
Zwraca wszystkie nazwy wszystkich testów. |
boolean
|
hasFailedTests()
Zwraca informacje o tym, czy wywołanie miało jakieś nieudane testy lub nieudane testy założeń. |
boolean
|
hasTestRunResultsForName(String testRunName)
Zwraca informacje o tym, czy podana nazwa testu zawiera jakieś wyniki. |
void
|
invocationEnded(long elapsedTime)
|
void
|
invocationFailed(Throwable cause)
|
void
|
invocationStarted(IInvocationContext context)
|
void
|
logAssociation(String dataName, LogFile logFile)
|
void
|
setBuildInfo(IBuildInfo buildInfo)
Ta metoda została wycofana. Nie są już potrzebne do testowania. |
void
|
setMergeStrategy(MergeStrategy strategy)
Określa |
void
|
testAssumptionFailure(TestDescription test, String trace)
|
void
|
testAssumptionFailure(TestDescription test, FailureDescription failure)
|
void
|
testEnded(TestDescription test, long endTime,
|
void
|
testEnded(TestDescription test,
|
void
|
testFailed(TestDescription test, FailureDescription failure)
|
void
|
testFailed(TestDescription test, String trace)
|
void
|
testIgnored(TestDescription test)
|
void
|
testModuleEnded()
|
void
|
testModuleStarted(IInvocationContext moduleContext)
|
void
|
testRunEnded(long elapsedTime,
|
void
|
testRunFailed(FailureDescription failure)
|
void
|
testRunFailed(String errorMessage)
|
void
|
testRunStarted(String name, int numTests, int attemptNumber)
|
void
|
testRunStarted(String name, int numTests)
|
void
|
testRunStarted(String name, int numTests, int attemptNumber, long startTime)
|
void
|
testRunStopped(long elapsedTime)
|
void
|
testStarted(TestDescription test, long startTime)
|
void
|
testStarted(TestDescription test)
|
Chronione metody | |
---|---|
final
void
|
clearModuleLogFiles()
Umożliwia wyczyszczenie pliku modułu, aby nie przechowywać ich zbyt długo. |
final
void
|
clearResultsForName(String testRunName)
Umożliwia wyczyszczenie wyników dla danego nazwy procesu. |
void
|
setIsAggregrateMetrics(boolean aggregate)
Przełącz opcję „Dane zbiorcze”. |
Konstruktory publiczne
CollectingTestListener
public CollectingTestListener ()
Metody publiczne
getBuildInfo
public IBuildInfo getBuildInfo ()
Ta metoda została wycofana.
polegaj na IBuildInfo
z getInvocationContext()
.
Zwraca informacje o kompilacji.
Zwroty | |
---|---|
IBuildInfo |
getCurrentRunResults
public TestRunResult getCurrentRunResults ()
Pobiera wyniki bieżącego testu.
Pamiętaj, że wyniki mogą być niepełne. Przed przetworzeniem wyników zalecamy przetestowanie wartości TestRunResult.isRunComplete()
lub (@link TestRunResult#isRunFailure()).
Zwroty | |
---|---|
TestRunResult |
TestRunResult reprezentujące dane zebrane podczas ostatniego uruchomienia testu.
|
getExpectedTests
public int getExpectedTests ()
Zwraca liczbę oczekiwanych testów. Może się różnić od getNumTotalTests()
, jeśli niektóre testy nie zostały uruchomione.
Zwroty | |
---|---|
int |
getInvocationContext
public IInvocationContext getInvocationContext ()
Zwraca kontekst wywołania zgłoszonego za pomocą invocationStarted(com.android.tradefed.invoker.IInvocationContext)
Zwroty | |
---|---|
IInvocationContext |
getMergedTestRunResults
publicgetMergedTestRunResults ()
Zwraca złączoną kolekcję wyników wszystkich przebiegów w różnych próbach.
Jeśli jest ich więcej, każdy przebieg testu jest scalany, a najnowsze wyniki testu zastępują wyniki poprzednich przebiegów. Przebiegi testów są uporządkowane według numeru próby.
Dane dotyczące tej samej próby zostaną scalone na podstawie ustawień preferencji określonych przez aggregate-metrics
. Ostateczne dane będą pochodzić z ostatniej próby.
Zwroty | |
---|---|
|
getModuleContextForRunResult
public IInvocationContext getModuleContextForRunResult (String testRunName)
Zwraca IInvocationContext
modułu powiązanego z wynikami.
Parametry | |
---|---|
testRunName |
String : nazwa podana przez {testRunStarted(String, int) . |
Zwroty | |
---|---|
IInvocationContext |
IInvocationContext modułu dla danej nazwy testu null jeśli nie ma wyników dla tej nazwy.
|
getModuleLogFiles
public MultiMap<String, LogFile> getModuleLogFiles ()
Zwraca kopię mapy zawierającą wszystkie pliki z rejestrowanymi zdarzeniami powiązane z modułem.
Zwroty | |
---|---|
MultiMap<String, LogFile> |
getNonAssociatedLogFiles
public MultiMap<String, LogFile> getNonAssociatedLogFiles ()
Zwraca kopię mapy zawierającą wszystkie pliki z dziennikiem, które nie są powiązane z testem ani z modułem.
Zwroty | |
---|---|
MultiMap<String, LogFile> |
getNumAllFailedTestRuns
public int getNumAllFailedTestRuns ()
Zwraca łączną liczbę uruchomień testu w stanie niepowodzenia
Zwroty | |
---|---|
int |
getNumAllFailedTests
public int getNumAllFailedTests ()
Zwraca łączną liczbę testów w stanie niepowodzenia (uwzględniane są tylko nieudane testy, a nie błędy w założeniach).
Zwroty | |
---|---|
int |
getNumTestsInState
public int getNumTestsInState (TestResult.TestStatus status)
Zwraca liczbę testów w danym stanie w ramach tego uruchomienia.
Parametry | |
---|---|
status |
TestResult.TestStatus |
Zwroty | |
---|---|
int |
getNumTotalTests
public int getNumTotalTests ()
Zwraca łączną liczbę ukończonych testów dla wszystkich przebiegów.
Zwroty | |
---|---|
int |
getPrimaryBuildInfo
public IBuildInfo getPrimaryBuildInfo ()
Zwraca informacje o głównej wersji, które zostały zgłoszone za pomocą invocationStarted(com.android.tradefed.invoker.IInvocationContext)
. Kompilacja podstawowa to kompilacja zwracana przez pierwszego dostawcę kompilacji dla bieżącej konfiguracji. Zwraca wartość null, jeśli nie ma kontekstu (nie ma kompilacji do testu).
Zwroty | |
---|---|
IBuildInfo |
getRunResults
publicgetRunResults ()
Ta metoda została wycofana.
Użyj getMergedTestRunResults()
Zwraca wyniki wszystkich testów.
Zwroty | |
---|---|
|
getTestRunAtAttempt
public TestRunResult getTestRunAtAttempt (String testRunName, int attempt)
Zwracaj TestRunResult
za każdą próbę.
Parametry | |
---|---|
testRunName |
String : nazwa podana przez {testRunStarted(String, int) . |
attempt |
int : identyfikator próby. |
Zwroty | |
---|---|
TestRunResult |
TestRunResult dla danej nazwy i identyfikatora próby lub null , jeśli nie istnieje.
|
getTestRunAttemptCount
public int getTestRunAttemptCount (String testRunName)
Zwraca liczbę prób dla danej nazwy testu.
Parametry | |
---|---|
testRunName |
String : nazwa podana przez {testRunStarted(String, int) .
|
Zwroty | |
---|---|
int |
getTestRunAttempts
publicgetTestRunAttempts (String testRunName)
Pobiera wszystkie próby TestRunResult
danego testu.
Parametry | |
---|---|
testRunName |
String : nazwa podana przez {testRunStarted(String, int) . |
Zwroty | |
---|---|
|
Wszystkie TestRunResult dla danego przetestowania, posortowane według prób.
|
getTestRunForAttempts
publicgetTestRunForAttempts (int attempt)
Pobiera wszystkie wyniki dla danej próby.
Parametry | |
---|---|
attempt |
int : próba, dla której chcemy uzyskać wyniki. |
Zwroty | |
---|---|
|
Wszystkie TestRunResult dla danej próby.
|
getTestRunNames
publicgetTestRunNames ()
Zwraca wszystkie nazwy wszystkich testów.
Te testy mogły być przeprowadzane wielokrotnie z różnymi próbami.
Zwroty | |
---|---|
|
hasFailedTests
public boolean hasFailedTests ()
Zwraca informacje o tym, czy wywołanie miało jakieś nieudane testy lub nieudane testy założeń.
Zwroty | |
---|---|
boolean |
hasTestRunResultsForName
public boolean hasTestRunResultsForName (String testRunName)
Zwraca informacje o tym, czy podana nazwa testu zawiera jakieś wyniki.
Parametry | |
---|---|
testRunName |
String : nazwa podana przez {testRunStarted(String, int) .
|
Zwroty | |
---|---|
boolean |
invocationEnded
public void invocationEnded (long elapsedTime)
Parametry | |
---|---|
elapsedTime |
long |
invocationFailed
public void invocationFailed (Throwable cause)
Parametry | |
---|---|
cause |
Throwable |
invocationStarted
public void invocationStarted (IInvocationContext context)
Parametry | |
---|---|
context |
IInvocationContext |
logAssociation
public void logAssociation (String dataName, LogFile logFile)
Parametry | |
---|---|
dataName |
String |
logFile |
LogFile |
setBuildInfo
public void setBuildInfo (IBuildInfo buildInfo)
Ta metoda została wycofana.
Nie są już potrzebne do testowania.
Ustaw informacje o wersji. Należy ich używać tylko do testowania.
Parametry | |
---|---|
buildInfo |
IBuildInfo |
setMergeStrategy
public void setMergeStrategy (MergeStrategy strategy)
Określa MergeStrategy
, który ma być używany podczas łączenia wyników.
Parametry | |
---|---|
strategy |
MergeStrategy |
testAssumptionFailure
public void testAssumptionFailure (TestDescription test, String trace)
Parametry | |
---|---|
test |
TestDescription |
trace |
String |
testAssumptionFailure
public void testAssumptionFailure (TestDescription test, FailureDescription failure)
Parametry | |
---|---|
test |
TestDescription |
failure |
FailureDescription |
testEnded
public void testEnded (TestDescription test, long endTime,testMetrics)
Parametry | |
---|---|
test |
TestDescription |
endTime |
long |
testMetrics |
|
testEnded
public void testEnded (TestDescription test,testMetrics)
Parametry | |
---|---|
test |
TestDescription |
testMetrics |
|
testFailed
public void testFailed (TestDescription test, FailureDescription failure)
Parametry | |
---|---|
test |
TestDescription |
failure |
FailureDescription |
testFailed
public void testFailed (TestDescription test, String trace)
Parametry | |
---|---|
test |
TestDescription |
trace |
String |
testIgnored
public void testIgnored (TestDescription test)
Parametry | |
---|---|
test |
TestDescription |
testModuleEnded
public void testModuleEnded ()
testModuleStarted
public void testModuleStarted (IInvocationContext moduleContext)
Parametry | |
---|---|
moduleContext |
IInvocationContext |
testRunEnded
public void testRunEnded (long elapsedTime,runMetrics)
Parametry | |
---|---|
elapsedTime |
long |
runMetrics |
|
testRunFailed
public void testRunFailed (FailureDescription failure)
Parametry | |
---|---|
failure |
FailureDescription |
testRunFailed
public void testRunFailed (String errorMessage)
Parametry | |
---|---|
errorMessage |
String |
testRunStarted
public void testRunStarted (String name, int numTests, int attemptNumber)
Parametry | |
---|---|
name |
String |
numTests |
int |
attemptNumber |
int |
testRunStarted
public void testRunStarted (String name, int numTests)
Parametry | |
---|---|
name |
String |
numTests |
int |
testRunStarted
public void testRunStarted (String name, int numTests, int attemptNumber, long startTime)
Parametry | |
---|---|
name |
String |
numTests |
int |
attemptNumber |
int |
startTime |
long |
testRunStopped
public void testRunStopped (long elapsedTime)
Parametry | |
---|---|
elapsedTime |
long |
testStarted
public void testStarted (TestDescription test, long startTime)
Parametry | |
---|---|
test |
TestDescription |
startTime |
long |
testStarted
public void testStarted (TestDescription test)
Parametry | |
---|---|
test |
TestDescription |
Chronione metody
clearModuleLogFiles
protected final void clearModuleLogFiles ()
Umożliwia wyczyszczenie pliku modułu, aby nie przechowywać ich zbyt długo.
clearResultsForName
protected final void clearResultsForName (String testRunName)
Umożliwia wyczyszczenie wyników dla danego nazwy procesu. Należy używać tylko w niektórych przypadkach, np. jako agregator wyników.
Parametry | |
---|---|
testRunName |
String |
setIsAggregrateMetrics
protected void setIsAggregrateMetrics (boolean aggregate)
Przełącz opcję „Dane zbiorcze”.
Parametry | |
---|---|
aggregate |
boolean |