XmlTestRunListener
public
class
XmlTestRunListener
extends Object
implements
ITestRunListener
| java.lang.Object | |
| ↳ | com.android.ddmlib.testrunner.XmlTestRunListener |
Scrive i risultati JUnit in file XML in un formato coerente con XMLJUnitResultFormatter di Ant.
Crea un file XML separato per ogni esecuzione del test.
Riepilogo
Costruttori pubblici | |
|---|---|
XmlTestRunListener()
|
|
Metodi pubblici | |
|---|---|
void
|
addSystemError(String systemError)
Aggiungi il messaggio di errore di sistema. |
TestRunResult
|
getRunResult()
Restituisce il valore |
String
|
getSystemError()
Restituisce il messaggio di errore di sistema da scrivere nel file XML nell'elemento "system-err". |
void
|
setHostName(String hostName)
|
void
|
setReportDir(File file)
Imposta il file del report da utilizzare. |
void
|
testAssumptionFailure(TestIdentifier test, String trace)
Chiamato quando un test atomico segnala che presuppone una condizione falsa |
void
|
testEnded(TestIdentifier test,
Segnala la fine dell'esecuzione di un singolo scenario di test. |
void
|
testFailed(TestIdentifier test, String trace)
Segnala l'esito negativo di un singolo caso di test. |
void
|
testIgnored(TestIdentifier test)
Chiamato quando un test non verrà eseguito, in genere perché un metodo di test è annotato con org.junit.Ignore. |
void
|
testRunEnded(long elapsedTime,
Segnala la fine dell'esecuzione del test. |
void
|
testRunFailed(String errorMessage)
L'esecuzione del test dei report non è stata completata a causa di un errore irreversibile. |
void
|
testRunStarted(String runName, int numTests)
Segnala l'inizio di un'esecuzione del test. |
void
|
testRunStopped(long elapsedTime)
L'esecuzione di prova dei report è stata interrotta prima del completamento a causa di una richiesta dell'utente. |
void
|
testStarted(TestIdentifier test)
Segnala l'inizio di un singolo scenario di test. |
Metodi protetti | |
|---|---|
|
getPropertiesAttributes()
Recupera gli attributi delle proprietà come coppie chiave-valore da includere nel report di test. |
File
|
getResultFile(File reportDir)
Crea un |
String
|
getTestName(TestIdentifier testId)
|
String
|
getTestSuiteName()
|
Costruttori pubblici
XmlTestRunListener
public XmlTestRunListener ()
Metodi pubblici
addSystemError
public void addSystemError (String systemError)
Aggiungi il messaggio di errore di sistema.
| Parametri | |
|---|---|
systemError |
String |
getRunResult
public TestRunResult getRunResult ()
Restituisce il valore TestRunResult
| Ritorni | |
|---|---|
TestRunResult |
i risultati dell'esecuzione del test. |
getSystemError
public String getSystemError ()
Restituisce il messaggio di errore di sistema da scrivere nel file XML nell'elemento "system-err". L'elemento non viene creato se viene restituita una stringa vuota.
| Ritorni | |
|---|---|
String |
|
setHostName
public void setHostName (String hostName)
| Parametri | |
|---|---|
hostName |
String |
setReportDir
public void setReportDir (File file)
Imposta il file del report da utilizzare.
| Parametri | |
|---|---|
file |
File |
testAssumptionFailure
public void testAssumptionFailure (TestIdentifier test, String trace)
Chiamato quando un test atomico segnala che presuppone una condizione falsa
| Parametri | |
|---|---|
test |
TestIdentifier: identifica il test |
trace |
String: analisi dello stack dell'errore |
testEnded
public void testEnded (TestIdentifier test,testMetrics)
Segnala la fine dell'esecuzione di un singolo scenario di test.
Se testFailed(TestIdentifier, String) 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 |
TestIdentifier: identifica il test |
testMetrics |
: un ERROR(/Map) delle metriche emesse durante l'esecuzione dello scenario di test
da android.app.Instrumentation#sendStatus. L'ordine di inserimento viene mantenuto
a meno che non emetti più volte la stessa chiave. Tieni presente che le chiavi standard definite in IInstrumentationResultParser.StatusKeys vengono filtrate da questa mappa. Ddmlib potrebbe aggiungere
metriche di test aggiuntive definite in IInstrumentationResultParser.StatusKeys. |
testFailed
public void testFailed (TestIdentifier test, String trace)
Segnala l'esito negativo di un singolo caso di test.
Verrà chiamato tra testStarted e testEnded.
| Parametri | |
|---|---|
test |
TestIdentifier: identifica il test |
trace |
String: analisi dello stack dell'errore |
testIgnored
public void testIgnored (TestIdentifier test)
Chiamato quando un test non verrà eseguito, in genere perché un metodo di test è annotato con org.junit.Ignore.
| Parametri | |
|---|---|
test |
TestIdentifier: identifica il test |
testRunEnded
public void testRunEnded (long elapsedTime,
runMetrics) Segnala la fine dell'esecuzione del test.
| Parametri | |
|---|---|
elapsedTime |
long: tempo trascorso segnalato dal dispositivo, in millisecondi |
runMetrics |
: un ERROR(/Map) delle metriche emesse durante l'esecuzione dello scenario di test
da android.app.Instrumentation#addResults. L'ordine di inserimento viene mantenuto
a meno che non emetti più volte la stessa chiave. Tieni presente che le chiavi standard definite in IInstrumentationResultParser.StatusKeys vengono filtrate da questa mappa. Ddmlib potrebbe aggiungere
metriche di test aggiuntive definite in IInstrumentationResultParser.StatusKeys. |
testRunFailed
public void testRunFailed (String errorMessage)
L'esecuzione del test dei report non è stata completata a causa di un errore irreversibile.
| Parametri | |
|---|---|
errorMessage |
String: String che descrive il motivo dell'errore di esecuzione. |
testRunStarted
public void testRunStarted (String runName,
int numTests)Segnala l'inizio di un'esecuzione del test.
| Parametri | |
|---|---|
runName |
String: il nome dell'esecuzione di test |
numTests |
int: numero totale di test nell'esecuzione di test |
testRunStopped
public void testRunStopped (long elapsedTime)
L'esecuzione di prova dei report è stata interrotta prima del completamento a causa di una richiesta dell'utente.
| Parametri | |
|---|---|
elapsedTime |
long: tempo trascorso segnalato dal dispositivo, in millisecondi |
testStarted
public void testStarted (TestIdentifier test)
Segnala l'inizio di un singolo scenario di test.
| Parametri | |
|---|---|
test |
TestIdentifier: identifica il test |
Metodi protetti
getPropertiesAttributes
protectedgetPropertiesAttributes ()
Recupera gli attributi delle proprietà come coppie chiave-valore da includere nel report di test.
| Ritorni | |
|---|---|
|
|
getResultFile
protected File getResultFile (File reportDir)
Crea un ERROR(/File) in cui verrà creato il report.
| Parametri | |
|---|---|
reportDir |
File: la directory principale del report. |
| Ritorni | |
|---|---|
File |
un file |
| Lanci | |
|---|---|
|
IOException |
getTestName
protected String getTestName (TestIdentifier testId)
| Parametri | |
|---|---|
testId |
TestIdentifier |
| Ritorni | |
|---|---|
String |
|
getTestSuiteName
protected String getTestSuiteName ()
| Ritorni | |
|---|---|
String |
|