GTestResultParser

public class GTestResultParser
extends MultiLineReceiver

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


Analizuje wyniki testów natywnych w „trybie surowych danych wyjściowych” za pomocą GTest, które są uruchamiane z poziomu powłoki, i informuje ITestInvocationListener o wynikach.

Przykładowy format oczekiwanych danych wyjściowych:

 Messages before the start test run marker [==========] 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
 

gdzie te tagi są używane do sygnalizowania określonych zdarzeń:

 [==========]: 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)
 
Wszystkie inne wiersze są ignorowane.

Podsumowanie

Konstruktory publiczne

GTestResultParser(String testRunName, ITestInvocationListener listener)

Tworzy GTestResultParser dla pojedynczego odbiorcy.

GTestResultParser(String testRunName, ITestInvocationListener listener, boolean allowRustTestName)

Tworzy GTestResultParser dla pojedynczego odbiorcy.

GTestResultParser(String testRunName, Collection<ITestInvocationListener> listeners)

Tworzy GTestResultParser.

GTestResultParser(String testRunName, Collection<ITestInvocationListener> listeners, boolean allowRustTestName)

Tworzy GTestResultParser.

Metody publiczne

void cancel()

Żąda anulowania sesji testowej.

void done()

Wywoływana przez element nadrzędny po zakończeniu sesji adb.

Set<String> getFailedTests()

Zwraca listę testów, które nie powiodły się podczas bieżącej sesji testowej.

boolean getPrependFileName()
boolean isCancelled()

Zwraca wartość „prawda”, jeśli sesja testowa została anulowana.

boolean isTestRunIncomplete()

Informuje, czy sesja testowa została ukończona.

void processNewLines(String[] lines)

Wywoływana, gdy proces zdalny otrzymuje nowe wiersze.

void setPrependFileName(boolean prepend)

Metody chronione

boolean isUnexpectedTestFound()

Udostępniona na potrzeby testowania jednostkowego.

Konstruktory publiczne

GTestResultParser

public GTestResultParser (String testRunName, 
                ITestInvocationListener listener)

Tworzy GTestResultParser dla pojedynczego odbiorcy.

Parametry
testRunName String: nazwa sesji testowej, która ma zostać przekazana do ITestInvocationListener.testRunStarted(String,int)

listener ITestInvocationListener: informuje o wynikach testów w trakcie ich wykonywania

GTestResultParser

public GTestResultParser (String testRunName, 
                ITestInvocationListener listener, 
                boolean allowRustTestName)

Tworzy GTestResultParser dla pojedynczego odbiorcy.

Parametry
testRunName String: nazwa sesji testowej, która ma zostać przekazana do ITestInvocationListener.testRunStarted(String,int)

listener ITestInvocationListener: informuje o wynikach testów w trakcie ich wykonywania

allowRustTestName boolean: zezwala na nazwy testów, które nie są zgodne ze wzorcem rozdzielonym znakiem „.”

GTestResultParser

public GTestResultParser (String testRunName, 
                Collection<ITestInvocationListener> listeners)

Tworzy GTestResultParser.

Parametry
testRunName String: nazwa sesji testowej, która ma zostać przekazana do ITestInvocationListener.testRunStarted(String,int)

listeners Collection: informuje o wynikach testów w trakcie ich wykonywania

GTestResultParser

public GTestResultParser (String testRunName, 
                Collection<ITestInvocationListener> listeners, 
                boolean allowRustTestName)

Tworzy GTestResultParser.

Parametry
testRunName String: nazwa sesji testowej, która ma zostać przekazana do ITestInvocationListener.testRunStarted(String,int)

listeners Collection: informuje o wynikach testów w trakcie ich wykonywania

allowRustTestName boolean: zezwala na nazwy testów, które nie są zgodne ze wzorcem rozdzielonym znakiem „::”

Metody publiczne

cancel

public void cancel ()

Żąda anulowania sesji testowej.

done

public void done ()

Wywoływana przez element nadrzędny po zakończeniu sesji adb.

getFailedTests

public Set<String> getFailedTests ()

Zwraca listę testów, które nie powiodły się podczas bieżącej sesji testowej.

Zwraca
Set<String>

getPrependFileName

public boolean getPrependFileName ()

Zwraca
boolean

isCancelled

public boolean isCancelled ()

Zwraca wartość „prawda”, jeśli sesja testowa została anulowana.

Zwraca
boolean

isTestRunIncomplete

public boolean isTestRunIncomplete ()

Informuje, czy sesja testowa została ukończona.

Zwraca
boolean Wartość „prawda”, jeśli sesja testowa została przerwana z powodu problemów z analizowaniem lub awarii.

processNewLines

public void processNewLines (String[] lines)

Wywoływana, gdy proces zdalny otrzymuje nowe wiersze.

Gwarantuje się, że wiersze są kompletne, gdy są przekazywane do tej metody.

Parametry
lines String: tablica zawierająca nowe wiersze.

setPrependFileName

public void setPrependFileName (boolean prepend)

Parametry
prepend boolean

Metody chronione

isUnexpectedTestFound

protected boolean isUnexpectedTestFound ()

Udostępniona na potrzeby testowania jednostkowego.

Zwraca
boolean