GTestResultParser

public class GTestResultParser
extends MultiLineReceiver

java.lang.Object
   ↳ com.android.ddmlib.MultiLineReceiver
     ↳ com.android.tradefed.testtype.GTestResultParser


Analizza i risultati della "modalità di output non elaborato" dei test nativi che vengono eseguiti dalla shell utilizzando GTest e comunica i risultati a un ITestInvocationListener.

Formato di esempio dell'output previsto:

 [==========] Running 15 tests from 1 test case.
 [----------] Global test environment set-up.
 [----------] 15 tests from MessageTest
 [ RUN      ] MessageTest.DefaultConstructor
 [       OK ] MessageTest.DefaultConstructor (1 ms)
 [ RUN      ] MessageTest.CopyConstructor
 external/gtest/test/gtest-message_test.cc:67: Failure
 Value of: 5
 Expected: 2
 external/gtest/test/gtest-message_test.cc:68: Failure
 Value of: 1 == 1
 Actual: true
 Expected: false
 [  FAILED  ] MessageTest.CopyConstructor (2 ms)
  ...
 [ RUN      ] MessageTest.DoesNotTakeUpMuchStackSpace
 [       OK ] MessageTest.DoesNotTakeUpMuchStackSpace (0 ms)
 [----------] 15 tests from MessageTest (26 ms total)

 [----------] Global test environment tear-down
 [==========] 15 tests from 1 test case ran. (26 ms total)
 [  PASSED  ] 6 tests.
 [  FAILED  ] 9 tests, listed below:
 [  FAILED  ] MessageTest.CopyConstructor
 [  FAILED  ] MessageTest.ConstructsFromCString
 [  FAILED  ] MessageTest.StreamsCString
 [  FAILED  ] MessageTest.StreamsNullCString
 [  FAILED  ] MessageTest.StreamsString
 [  FAILED  ] MessageTest.StreamsStringWithEmbeddedNUL
 [  FAILED  ] MessageTest.StreamsNULChar
 [  FAILED  ] MessageTest.StreamsInt
 [  FAILED  ] MessageTest.StreamsBasicIoManip
 9 FAILED TESTS
 

dove i seguenti tag vengono utilizzati per segnalare determinati eventi:

 [==========]: the first occurrence indicates a new run started, including the number of tests
                  to be expected in this run
 [ RUN      ]: indicates a new test has started to run; a series of zero or more lines may
                  follow a test start, and will be captured in case of a test failure or error
 [       OK ]: the preceding test has completed successfully, optionally including the time it
                  took to run (in ms)
 [  FAILED  ]: the preceding test has failed, optionally including the time it took to run (in ms)
 [==========]: the preceding test run has completed, optionally including the time it took to run
                  (in ms)
 
Tutte le altre righe vengono ignorate.

Riepilogo

Costruttori pubblici

GTestResultParser(String testRunName, listeners)

Crea GTestResultParser.

GTestResultParser(String testRunName, listeners, boolean allowRustTestName)

Crea GTestResultParser.

Metodi pubblici

void cancel()

Richiede l'annullamento dell'esecuzione di prova.

void done()

Chiamato dal genitore al termine della sessione adb.

getFailedTests()

Restituisce un elenco di test non riusciti durante l'esecuzione del test corrente.

boolean getPrependFileName()
boolean isCancelled()

Restituisce true se l'esecuzione del test è stata annullata.

boolean isTestRunIncomplete()

Indica se l'esecuzione di test è incompleta o meno.

void processNewLines(String[] lines)

Chiamato quando il processo remoto riceve nuove righe.

void setPrependFileName(boolean prepend)

Metodi protetti

boolean isUnexpectedTestFound()

Esposto per il test delle unità.

Costruttori pubblici

GTestResultParser

public GTestResultParser (String testRunName, 
                 listeners)

Crea GTestResultParser.

Parametri
testRunName String: il nome dell'esecuzione di test da fornire a ITestLifeCycleReceiver.testRunStarted(String, int)

listeners : informato dei risultati dei test durante l'esecuzione

GTestResultParser

public GTestResultParser (String testRunName, 
                 listeners, 
                boolean allowRustTestName)

Crea GTestResultParser.

Parametri
testRunName String: il nome dell'esecuzione di test da fornire a ITestLifeCycleReceiver.testRunStarted(String, int)

listeners : informato dei risultati dei test durante l'esecuzione

allowRustTestName boolean: consente ai nomi dei test di non seguire il pattern di separazione "::"

Metodi pubblici

annulla

public void cancel ()

Richiede l'annullamento dell'esecuzione di prova.

done

public void done ()

Chiamato dal genitore al termine della sessione adb.

getFailedTests

public  getFailedTests ()

Restituisce un elenco di test non riusciti durante l'esecuzione del test corrente.

Ritorni

getPrependFileName

public boolean getPrependFileName ()

Ritorni
boolean

isCancelled

public boolean isCancelled ()

Restituisce true se l'esecuzione del test è stata annullata.

Ritorni
boolean

isTestRunIncomplete

public boolean isTestRunIncomplete ()

Indica se l'esecuzione di test è incompleta o meno.

Ritorni
boolean true, se l'esecuzione di test è incompleta a causa di problemi di analisi o arresti anomali.

processNewLines

public void processNewLines (String[] lines)

Chiamato quando il processo remoto riceve nuove righe.

È garantito che le linee siano complete quando vengono fornite a questo metodo.

Parametri
lines String: l'array contenente le nuove righe.

setPrependFileName

public void setPrependFileName (boolean prepend)

Parametri
prepend boolean

Metodi protetti

isUnexpectedTestFound

protected boolean isUnexpectedTestFound ()

Esposto per il test delle unità.

Ritorni
boolean