Google致力於提高黑人社區的種族平等。 怎麼看。
本頁面由 Cloud Translation API 翻譯而成。
Switch to English

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 (String testRunName, listeners)

創建GTestResultParser。

公開方法

void cancel ()

要求取消測試運行。

void done ()

當adb會話完成時由父級調用。

boolean getPrependFileName ()
boolean isCancelled ()

如果測試運行被取消,則返回true。

void processNewLines (String[] lines)

void setPrependFileName (boolean prepend)

公共建設者

GTestResultParser

public GTestResultParser (String testRunName, 
                 listeners)

創建GTestResultParser。

參量
testRunName String :提供給ITestInvocationListener#testRunStarted(String, int)的測試運行名稱

listeners :在執行測試時通知測試結果

公開方法

取消

public void cancel ()

要求取消測試運行。

做完了

public void done ()

當adb會話完成時由父級調用。

getPrependFileName

public boolean getPrependFileName ()

退貨
boolean

取消

public boolean isCancelled ()

如果測試運行被取消,則返回true。

退貨
boolean

processNewLines

public void processNewLines (String[] lines)

參量
lines String

setPrependFileName

public void setPrependFileName (boolean prepend)

參量
prepend boolean