GTestResultParser

public class GTestResultParser
extends MultiLineReceiver

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


הקוד מפרק את התוצאות של 'מצב פלט גולמי' של בדיקות מקוריות באמצעות GTest שפועל מהמעטפת, ומעדכן את ITestInvocationListener בתוצאות.

פורמט לדוגמה של הפלט הצפוי:

 [==========] 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
 

שבהם התגים הבאים משמשים לסימון אירועים מסוימים:

 [==========]: 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)
 
המערכת מתעלמת מכל שאר הקווים.

סיכום

יוצרים ציבוריים

GTestResultParser(String testRunName, listeners)

יצירת GTestResultParser.

GTestResultParser(String testRunName, listeners, boolean allowRustTestName)

יצירת GTestResultParser.

שיטות ציבוריות

void cancel()

בקשה לביטול של הרצה לבדיקה.

void done()

הורה קורא לזה כשסשן adb מסתיים.

getFailedTests()

הפונקציה מחזירה רשימה של בדיקות שנכשלו במהלך הרצה הנוכחית של הבדיקה.

boolean getPrependFileName()
boolean isCancelled()

הפונקציה מחזירה את הערך true אם הרצה של הבדיקה בוטלה.

boolean isTestRunIncomplete()

האם ההרצה של הבדיקה הייתה חלקית או לא.

void processNewLines(String[] lines)

void setPrependFileName(boolean prepend)

שיטות מוגנות

boolean isUnexpectedTestFound()

חשוף לבדיקות יחידה.

יוצרים ציבוריים

GTestResultParser

public GTestResultParser (String testRunName, 
                 listeners)

יצירת GTestResultParser.

פרמטרים
testRunName String: שם הרצת הבדיקה שצריך לספק ל-ITestLifeCycleReceiver.testRunStarted(String, int)

listeners : קבלת עדכונים על תוצאות הבדיקה בזמן שהן מתבצעות

GTestResultParser

public GTestResultParser (String testRunName, 
                 listeners, 
                boolean allowRustTestName)

יצירת GTestResultParser.

פרמטרים
testRunName String: שם הרצת הבדיקה שצריך לספק ל-ITestLifeCycleReceiver.testRunStarted(String, int)

listeners : קבלת עדכונים על תוצאות הבדיקה בזמן שהן מתבצעות

allowRustTestName boolean: לאפשר לשמות בדיקות שלא לפעול לפי דפוס ההפרדה '::'

שיטות ציבוריות

ביטול

public void cancel ()

בקשה לביטול של הרצה לבדיקה.

done

public void done ()

ההורה קורא לזה כשסשן adb מסתיים.

getFailedTests

public  getFailedTests ()

הפונקציה מחזירה רשימה של בדיקות שנכשלו במהלך הרצה הנוכחית של הבדיקה.

החזרות

getPrependFileName

public boolean getPrependFileName ()

החזרות
boolean

isCancelled

public boolean isCancelled ()

הפונקציה מחזירה את הערך true אם הרצה של הבדיקה בוטלה.

החזרות
boolean

isTestRunIncomplete

public boolean isTestRunIncomplete ()

האם ההרצה של הבדיקה הייתה חלקית או לא.

החזרות
boolean true, אם הרצת הבדיקה לא הושלמה בגלל בעיות בניתוח או קריסות.

processNewLines

public void processNewLines (String[] lines)

פרמטרים
lines String

setPrependFileName

public void setPrependFileName (boolean prepend)

פרמטרים
prepend boolean

שיטות מוגנות

isUnexpectedTestFound

protected boolean isUnexpectedTestFound ()

חשוף לבדיקות יחידה.

החזרות
boolean