GTestResultParser

public class GTestResultParser
extends MultiLineReceiver

java.lang.オブジェクト
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 セッションが完了すると親によって呼び出されます。

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 : テストの実行中にテスト結果が通知されます

パブリックメソッド

キャンセル

public void cancel ()

試運転の中止を要求します。

終わり

public void done ()

adb セッションが完了すると親によって呼び出されます。

getFailedTests

public  getFailedTests ()

現在のテスト実行中に失敗したテストのリストを返します。

戻り値

getPrependFileName

public boolean getPrependFileName ()

戻り値
boolean

キャンセルされました

public boolean isCancelled ()

テスト実行がキャンセルされた場合は true を返します。

戻り値
boolean

以下も参照してください。

テスト実行は不完全です

public boolean isTestRunIncomplete ()

テスト実行が不完全であったかどうか。

戻り値
boolean true、解析の問題またはクラッシュによりテスト実行が不完全だった場合。

プロセス改行

public void processNewLines (String[] lines)

パラメーター
lines String

setPrependFileName

public void setPrependFileName (boolean prepend)

パラメーター
prepend boolean

保護されたメソッド

予期せぬテストが見つかりました

protected boolean isUnexpectedTestFound ()

単体テストのために公開されます。

戻り値
boolean