GTestResultParser

public class GTestResultParser
extends MultiLineReceiver

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


シェルから実行される GTest を使用してネイティブ テストの「未加工出力モード」の結果を解析し、結果を ITestInvocationListener に通知します。

想定される出力のサンプル形式:

 Messages before the start test run marker [==========] 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, ITestInvocationListener listener)

単一のリスナー用の GTestResultParser を作成します。

GTestResultParser(String testRunName, ITestInvocationListener listener, boolean allowRustTestName)

単一のリスナー用の GTestResultParser を作成します。

GTestResultParser(String testRunName, Collection<ITestInvocationListener> listeners)

GTestResultParser を作成します。

GTestResultParser(String testRunName, Collection<ITestInvocationListener> listeners, boolean allowRustTestName)

GTestResultParser を作成します。

パブリック メソッド

void cancel()

テスト実行のキャンセルをリクエストします。

void done()

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

Set<String> getFailedTests()

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

boolean getPrependFileName()
boolean isCancelled()

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

boolean isTestRunIncomplete()

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

void processNewLines(String[] lines)

リモート プロセスが新しい行を受信したときに呼び出されます。

void setPrependFileName(boolean prepend)

保護されたメソッド

boolean isUnexpectedTestFound()

単体テスト用に公開されています。

パブリック コンストラクタ

GTestResultParser

public GTestResultParser (String testRunName, 
                ITestInvocationListener listener)

単一のリスナー用の GTestResultParser を作成します。

パラメータ
testRunName String: ITestInvocationListener.testRunStarted(String,int) に提供するテスト実行名

listener ITestInvocationListener: テストの実行時にテスト結果が通知されます

GTestResultParser

public GTestResultParser (String testRunName, 
                ITestInvocationListener listener, 
                boolean allowRustTestName)

単一のリスナー用の GTestResultParser を作成します。

パラメータ
testRunName String: ITestInvocationListener.testRunStarted(String,int) に提供するテスト実行名

listener ITestInvocationListener: テストの実行時にテスト結果が通知されます

allowRustTestName boolean: テスト名が「.」で区切られたパターンに従わないことを許可します

GTestResultParser

public GTestResultParser (String testRunName, 
                Collection<ITestInvocationListener> listeners)

GTestResultParser を作成します。

パラメータ
testRunName String: ITestInvocationListener.testRunStarted(String,int) に提供するテスト実行名

listeners Collection: テストの実行時にテスト結果が通知されます

GTestResultParser

public GTestResultParser (String testRunName, 
                Collection<ITestInvocationListener> listeners, 
                boolean allowRustTestName)

GTestResultParser を作成します。

パラメータ
testRunName String: ITestInvocationListener.testRunStarted(String,int) に提供するテスト実行名

listeners Collection: テストの実行時にテスト結果が通知されます

allowRustTestName boolean: テスト名が「::」で区切られたパターンに従わないことを許可します

パブリック メソッド

キャンセル

public void cancel ()

テスト実行のキャンセルをリクエストします。

完了

public void done ()

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

getFailedTests

public Set<String> getFailedTests ()

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

戻り値
Set<String>

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