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,
建立 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 |
:在測試執行時接收測試結果通知 |
公用方法
cancel
public void cancel ()
取消測試執行作業的要求。
done
public void done ()
ADB 工作階段完成時,由父項呼叫。
getFailedTests
publicgetFailedTests ()
傳回在目前測試執行作業期間失敗的測試清單。
傳回 | |
---|---|
|
getPrependFileName
public boolean getPrependFileName ()
傳回 | |
---|---|
boolean |
已取消
public boolean isCancelled ()
如果測試執行已取消,則傳回 true。
傳回 | |
---|---|
boolean |
isTestRunIncomplete
public boolean isTestRunIncomplete ()
測試執行作業是否未完成。
傳回 | |
---|---|
boolean |
如果測試作業因剖析問題或當機而未完成,傳回 true。 |
程序新行
public void processNewLines (String[] lines)
參數 | |
---|---|
lines |
String |
setPrependFileName
public void setPrependFileName (boolean prepend)
參數 | |
---|---|
prepend |
boolean |
保護方法
isUnexpectedTest 找到
protected boolean isUnexpectedTestFound ()
可供單元測試使用。
傳回 | |
---|---|
boolean |