TestResultListener
public
abstract
class
TestResultListener
extends Object
implements
ITestLifeCycleReceiver
| java.lang.Object | |
| ↳ | com.android.tradefed.result.TestResultListener |
Una semplificazione di ITestLifecycleListener per gli implementatori che si interessano solo ai risultati dei singoli test.
Filtra i vari eventi del ciclo di vita fino a un metodo testResult.
Non è thread-safe e in particolare presuppone che gli eventi ITestLifecycleListener vengano ricevuti in ordine.
Riepilogo
Costruttori pubblici | |
|---|---|
TestResultListener()
|
|
Metodi pubblici | |
|---|---|
final
void
|
testAssumptionFailure(TestDescription test, String trace)
Chiamato quando un test atomico segnala che presuppone una condizione falsa |
final
void
|
testEnded(TestDescription test, long endTime, Map<String, String> testMetrics)
Alternativa a |
final
void
|
testEnded(TestDescription test, long endTime, HashMap<String, MetricMeasurement.Metric> testMetrics)
Alternativa a |
final
void
|
testEnded(TestDescription test, Map<String, String> testMetrics)
Segnala la fine dell'esecuzione di un singolo scenario di test. |
final
void
|
testEnded(TestDescription test, HashMap<String, MetricMeasurement.Metric> testMetrics)
Segnala la fine dell'esecuzione di un singolo scenario di test. |
final
void
|
testFailed(TestDescription test, String trace)
Segnala l'esito negativo di un singolo test case. |
final
void
|
testIgnored(TestDescription test)
Chiamato quando un test non verrà eseguito, in genere perché un metodo di test è annotato con org.junit.Ignore. |
abstract
void
|
testResult(TestDescription test, TestResult result)
|
void
|
testRunEnded(long elapsedTimeMillis, HashMap<String, MetricMeasurement.Metric> runMetrics)
Segnala la fine dell'esecuzione del test. |
void
|
testSkipped(TestDescription test, SkipReason reason)
Chiamato quando un test viene ignorato e non eseguito per un motivo insolito. |
final
void
|
testStarted(TestDescription test, long startTime)
Alternativa a |
final
void
|
testStarted(TestDescription test)
Segnala l'inizio di un singolo scenario di test. |
Costruttori pubblici
TestResultListener
public TestResultListener ()
Metodi pubblici
testAssumptionFailure
public final void testAssumptionFailure (TestDescription test, String trace)
Chiamato quando un test atomico segnala che presuppone una condizione falsa
| Parametri | |
|---|---|
test |
TestDescription: identifica il test |
trace |
String: analisi dello stack dell'errore |
testEnded
public final void testEnded (TestDescription test, long endTime, Map<String, String> testMetrics)
Alternativa a testEnded(TestDescription,Map) in cui possiamo specificare direttamente l'ora di fine. Combina con testStarted(TestDescription,long) per una misurazione accurata.
| Parametri | |
|---|---|
test |
TestDescription: identifica il test |
endTime |
long: l'ora in cui è terminato il test, misurata tramite System.currentTimeMillis() |
testMetrics |
Map: un Map delle metriche emesse |
testEnded
public final void testEnded (TestDescription test, long endTime, HashMap<String, MetricMeasurement.Metric> testMetrics)
Alternativa a testEnded(TestDescription,Map) in cui possiamo specificare direttamente l'ora di fine. Combina con testStarted(TestDescription,long) per una misurazione accurata.
| Parametri | |
|---|---|
test |
TestDescription: identifica il test |
endTime |
long: l'ora in cui è terminato il test, misurata tramite System.currentTimeMillis() |
testMetrics |
HashMap: un Map delle metriche emesse |
testEnded
public final void testEnded (TestDescription test, Map<String, String> testMetrics)
Segnala la fine dell'esecuzione di un singolo scenario di test.
Se testFailed(TestDescription, FailureDescription) non è stato richiamato, questo test è stato superato. Restituisce anche eventuali metriche chiave/valore
che potrebbero essere state emesse durante l'esecuzione dello scenario di test.
| Parametri | |
|---|---|
test |
TestDescription: identifica il test |
testMetrics |
Map: un Map delle metriche emesse |
testEnded
public final void testEnded (TestDescription test, HashMap<String, MetricMeasurement.Metric> testMetrics)
Segnala la fine dell'esecuzione di un singolo scenario di test.
Se testFailed(TestDescription, FailureDescription) non è stato richiamato, questo test è stato superato. Restituisce anche eventuali metriche chiave/valore
che potrebbero essere state emesse durante l'esecuzione dello scenario di test.
| Parametri | |
|---|---|
test |
TestDescription: identifica il test |
testMetrics |
HashMap: un Map delle metriche emesse |
testFailed
public final void testFailed (TestDescription test, String trace)
Segnala l'esito negativo di un singolo test case.
Verrà chiamato tra testStarted e testEnded.
| Parametri | |
|---|---|
test |
TestDescription: identifica il test |
trace |
String: analisi dello stack dell'errore |
testIgnored
public final void testIgnored (TestDescription test)
Chiamato quando un test non verrà eseguito, in genere perché un metodo di test è annotato con org.junit.Ignore.
| Parametri | |
|---|---|
test |
TestDescription: identifica il test |
testResult
public abstract void testResult (TestDescription test, TestResult result)
| Parametri | |
|---|---|
test |
TestDescription |
result |
TestResult |
testRunEnded
public void testRunEnded (long elapsedTimeMillis,
HashMap<String, MetricMeasurement.Metric> runMetrics)Segnala la fine dell'esecuzione del test. FIXME: We cannot have two Map<> interfaces with different type, so we have to use HashMap here.
| Parametri | |
|---|---|
elapsedTimeMillis |
long: tempo trascorso segnalato dal dispositivo, in millisecondi |
runMetrics |
HashMap: coppie chiave-valore riportate alla fine di un'esecuzione del test con Metric. |
testSkipped
public void testSkipped (TestDescription test, SkipReason reason)
Chiamato quando un test viene ignorato e non eseguito per un motivo insolito. Verrà effettuato un nuovo tentativo di esecuzione di questi test.
| Parametri | |
|---|---|
test |
TestDescription: identifica il test |
reason |
SkipReason: SkipReason |
testStarted
public final void testStarted (TestDescription test, long startTime)
Alternativa a testStarted(TestDescription), in cui specifichiamo anche quando è iniziato il test, combinata con testEnded(TestDescription,long,Map) per una misurazione accurata.
| Parametri | |
|---|---|
test |
TestDescription: identifica il test |
startTime |
long: l'ora di inizio del test, misurata tramite System.currentTimeMillis() |
testStarted
public final void testStarted (TestDescription test)
Segnala l'inizio di un singolo scenario di test. Interfaccia precedente, deve utilizzare testStarted(TestDescription) quando possibile.
| Parametri | |
|---|---|
test |
TestDescription: identifica il test |