GTestResultParser
public
class
GTestResultParser
extends MultiLineReceiver
java.lang.Object | ||
↳ | com.android.ddmlib.MultiLineReceiver | |
↳ | com.android.tradefed.testtype.GTestResultParser |
Mengurai 'raw output mode' hasil pengujian native menggunakan GTest yang dijalankan dari shell, dan memberi tahu ITestInvocationListener dari hasilnya.
Contoh format output yang diharapkan:
[==========] 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
yang menggunakan tag berikut untuk menandakan peristiwa tertentu:
[==========]: 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)Semua baris lainnya akan diabaikan.
Ringkasan
Konstruktor publik | |
---|---|
GTestResultParser(String testRunName,
Membuat GTestResultParser. |
Metode publik | |
---|---|
void
|
cancel()
Meminta pembatalan uji coba. |
void
|
done()
Dipanggil oleh induk saat sesi adb selesai. |
|
getFailedTests()
Menampilkan daftar pengujian yang gagal selama pengujian saat ini. |
boolean
|
getPrependFileName()
|
boolean
|
isCancelled()
Menampilkan true (benar) jika pengujian dibatalkan. |
boolean
|
isTestRunIncomplete()
Apakah pengujian yang dijalankan tidak selesai atau tidak. |
void
|
processNewLines(String[] lines)
|
void
|
setPrependFileName(boolean prepend)
|
Metode yang dilindungi | |
---|---|
boolean
|
isUnexpectedTestFound()
Diekspos untuk pengujian unit. |
Konstruktor publik
GTestResultParser
public GTestResultParser (String testRunName,listeners)
Membuat GTestResultParser.
Parameter | |
---|---|
testRunName |
String : nama pengujian yang akan diberikan ke ITestLifeCycleReceiver.testRunStarted(String, int) |
listeners |
: diberi tahu tentang hasil pengujian saat pengujian dijalankan |
Metode publik
batal
public void cancel ()
Meminta pembatalan uji coba.
done
public void done ()
Dipanggil oleh induk saat sesi adb selesai.
getFailedTests
publicgetFailedTests ()
Menampilkan daftar pengujian yang gagal selama pengujian saat ini.
Hasil | |
---|---|
|
getPrependFileName
public boolean getPrependFileName ()
Hasil | |
---|---|
boolean |
dibatalkan
public boolean isCancelled ()
Menampilkan true (benar) jika pengujian dibatalkan.
Hasil | |
---|---|
boolean |
Lihat juga:
isTestRunTidak Lengkap
public boolean isTestRunIncomplete ()
Apakah pengujian yang dijalankan tidak selesai atau tidak.
Hasil | |
---|---|
boolean |
true (benar), jika pengujian tidak selesai karena ada masalah penguraian atau error. |
processNewLines
public void processNewLines (String[] lines)
Parameter | |
---|---|
lines |
String |
setPrependFileName
public void setPrependFileName (boolean prepend)
Parameter | |
---|---|
prepend |
boolean |
Metode yang dilindungi
isUnexpectedTestFound
protected boolean isUnexpectedTestFound ()
Diekspos untuk pengujian unit.
Hasil | |
---|---|
boolean |