GTestResultParser
public
class
GTestResultParser
extends MultiLineReceiver
| java.lang.Object | ||
| ↳ | com.android.ddmlib.MultiLineReceiver | |
| ↳ | com.android.tradefed.testtype.GTestResultParser | |
Przetwarza wyniki testów natywnych w „trybie surowego wyjścia” za pomocą GTest, który działa w powłoce, oraz przekazuje je do klasy ITestInvocationListener.
Oczekiwany format danych wyjściowych:
[==========] 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 do sygnalizowania określonych zdarzeń służą te tagi:
[==========]: 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)
Podsumowanie
Konstruktory publiczne | |
|---|---|
GTestResultParser(String testRunName,
Tworzy obiekt GTestResultParser. |
|
GTestResultParser(String testRunName,
Tworzy obiekt GTestResultParser. |
|
Metody publiczne | |
|---|---|
void
|
cancel()
Prośba o anulowanie testu. |
void
|
done()
Wywoływany przez rodzica po zakończeniu sesji adb. |
|
getFailedTests()
Zwraca listę testów, które nie przeszły podczas bieżącego uruchomienia testu. |
boolean
|
getPrependFileName()
|
boolean
|
isCancelled()
Zwraca wartość „prawda”, jeśli test został anulowany. |
boolean
|
isTestRunIncomplete()
czy test był niekompletny. |
void
|
processNewLines(String[] lines)
|
void
|
setPrependFileName(boolean prepend)
|
Chronione metody | |
|---|---|
boolean
|
isUnexpectedTestFound()
Wyświetlane w celu testowania jednostkowego. |
Konstruktory publiczne
GTestResultParser
public GTestResultParser (String testRunName,
listeners) Tworzy obiekt GTestResultParser.
| Parametry | |
|---|---|
testRunName |
String: nazwa testu, który ma być przekazany do ITestLifeCycleReceiver.testRunStarted(String, int) |
listeners |
: informowanie o wynikach testów w trakcie ich wykonywania. |
GTestResultParser
public GTestResultParser (String testRunName,
listeners,
boolean allowRustTestName) Tworzy obiekt GTestResultParser.
| Parametry | |
|---|---|
testRunName |
String: nazwa testu, który ma być przekazany do ITestLifeCycleReceiver.testRunStarted(String, int) |
listeners |
: informowanie o wynikach testów w trakcie ich wykonywania. |
allowRustTestName |
boolean: zezwalaj na nazwy testów, które nie są rozdzielane znakiem „::” |
Metody publiczne
anuluj
public void cancel ()
Prośba o anulowanie testu.
gotowe
public void done ()
Wywoływany przez rodzica po zakończeniu sesji adb.
getFailedTests
publicgetFailedTests ()
Zwraca listę testów, które nie przeszły podczas bieżącego uruchomienia testu.
| Zwroty | |
|---|---|
|
|
getPrependFileName
public boolean getPrependFileName ()
| Zwroty | |
|---|---|
boolean |
|
isCancelled
public boolean isCancelled ()
Zwraca wartość „prawda”, jeśli test został anulowany.
| Zwroty | |
|---|---|
boolean |
|
Zobacz też:
isTestRunIncomplete
public boolean isTestRunIncomplete ()
czy test był niekompletny.
| Zwroty | |
|---|---|
boolean |
true, jeśli test nie został ukończony z powodu problemów z analizą lub awarii. |
processNewLines
public void processNewLines (String[] lines)
| Parametry | |
|---|---|
lines |
String |
setPrependFileName
public void setPrependFileName (boolean prepend)
| Parametry | |
|---|---|
prepend |
boolean |
Chronione metody
isUnexpectedTestFound
protected boolean isUnexpectedTestFound ()
Wyświetlane w celu testowania jednostkowego.
| Zwroty | |
|---|---|
boolean |
|