テストリスナーの収集

public class CollectingTestListener
extends Object implements ITestInvocationListener, ILogSaverListener

java.lang.オブジェクト
com.android.tradefed.result.CollectingTestListener


すべてのテスト結果を収集するITestInvocationListener

このオブジェクトで使用されるデータ構造はスレッドセーフですが、 ITestInvocationListenerコールバックは正しい順序で呼び出される必要があります。

まとめ

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

CollectingTestListener ()

パブリックメソッド

IBuildInfo getBuildInfo ()

このメソッドは廃止されました。 getInvocationContext()からのIBuildInfoに依存します。

TestRunResult getCurrentRunResults ()

現在のテスト実行の結果を取得します。

int getExpectedTests ()

予想されるテスト数を返します。

IInvocationContext getInvocationContext ()

invocationStarted(com.android.tradefed.invoker.IInvocationContext)経由で報告された呼び出しコンテキストを返します。

getMergedTestRunResults ()

さまざまな試行にわたるすべての実行の結果のマージされたコレクションを返します。

IInvocationContext getModuleContextForRunResult (String testRunName)

結果に関連付けられたモジュールのIInvocationContextを返します。

MultiMap<String, LogFile> getModuleLogFiles ()

モジュールに関連付けられたすべてのログファイルを含むマップのコピーを返します。

MultiMap<String, LogFile> getNonAssociatedLogFiles ()

テスト実行またはモジュールに関連付けられていないすべてのログ ファイルを含むマップのコピーを返します。

int getNumAllFailedTestRuns ()

失敗状態で実行されたテストの合計数を返します。

int getNumAllFailedTests ()

失敗状態にあるテストの合計数を返します (失敗のみ。想定失敗はカウントされません)。

int getNumTestsInState (TestResult.TestStatus status)

この実行で指定された状態にあるテストの数を返します。

int getNumTotalTests ()

すべての実行に対する完了したテストの合計数を返します。

IBuildInfo getPrimaryBuildInfo ()

invocationStarted(com.android.tradefed.invoker.IInvocationContext)経由で報告されたプライマリ ビルド情報を返します。

getRunResults ()

このメソッドは廃止されました。 getMergedTestRunResults()を使用する

TestRunResult getTestRunAtAttempt (String testRunName, int attempt)

1 回の試行に対するTestRunResultを返します。

int getTestRunAttemptCount (String testRunName)

指定されたテスト実行名の試行回数を返します。

getTestRunAttempts (String testRunName)

指定されたテスト実行のTestRunResultに対するすべての試行を取得します。

getTestRunForAttempts (int attempt)

指定された試行に対するすべての結果を取得します。

getTestRunNames ()

すべてのテスト実行のすべての名前を返します。

boolean hasFailedTests ()

呼び出しに失敗したテストまたは仮定に失敗したテストがあった場合に返します。

boolean hasTestRunResultsForName (String testRunName)

指定されたテスト実行名に結果があるかどうかを返します。

void invocationEnded (long elapsedTime)

void invocationFailed (Throwable cause)

void invocationStarted (IInvocationContext context)

void logAssociation (String dataName, LogFile logFile)

void setBuildInfo (IBuildInfo buildInfo)

このメソッドは廃止されました。もうテストには必要ありません。

void setMergeStrategy (MergeStrategy strategy)

結果をマージするときに使用するMergeStrategyを設定します。

void testAssumptionFailure (TestDescription test, String trace)
void testAssumptionFailure (TestDescription test, FailureDescription failure)
void testEnded (TestDescription test, long endTime, testMetrics) testEnded (TestDescription test, long endTime, testMetrics)

void testEnded (TestDescription test, testMetrics) testEnded (TestDescription test, testMetrics)

void testFailed (TestDescription test, FailureDescription failure)
void testFailed (TestDescription test, String trace)

void testIgnored (TestDescription test)
void testModuleEnded ()
void testModuleStarted (IInvocationContext moduleContext)
void testRunEnded (long elapsedTime, runMetrics) testRunEnded (long elapsedTime, runMetrics)

void testRunFailed (FailureDescription failure)

void testRunFailed (String errorMessage)

void testRunStarted (String name, int numTests, int attemptNumber)

void testRunStarted (String name, int numTests)

void testRunStarted (String name, int numTests, int attemptNumber, long startTime)

void testRunStopped (long elapsedTime)

void testStarted (TestDescription test, long startTime)

void testStarted (TestDescription test)

保護されたメソッド

final void clearModuleLogFiles ()

モジュール ファイルをクリーニングできるため、長時間持ち運ぶことがなくなります。

final void clearResultsForName (String testRunName)

指定された実行名の結果をクリアできます。

void setIsAggregrateMetrics (boolean aggregate)

「集計メトリクス」オプションを切り替えます

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

テストリスナーの収集

public CollectingTestListener ()

パブリックメソッド

ビルド情報の取得

public IBuildInfo getBuildInfo ()

このメソッドは廃止されました。
getInvocationContext()からのIBuildInfoに依存します。

ビルド情報を返します。

戻り値
IBuildInfo

getCurrentRunResults

public TestRunResult getCurrentRunResults ()

現在のテスト実行の結果を取得します。

結果は完全ではない可能性があることに注意してください。結果を処理する前に、必要に応じてTestRunResult.isRunComplete()および/または (@link TestRunResult#isRunFailure()}) の値をテストすることをお勧めします。

戻り値
TestRunResult前回のテスト実行中に収集されたデータを表すTestRunResult

getExpectedTests

public int getExpectedTests ()

予想されるテスト数を返します。一部のテストが実行されなかった場合は、 getNumTotalTests()とは異なる可能性があります。

戻り値
int

getInvocationContext

public IInvocationContext getInvocationContext ()

invocationStarted(com.android.tradefed.invoker.IInvocationContext)経由で報告された呼び出しコンテキストを返します。

戻り値
IInvocationContext

getMergedTestRunResults

public  getMergedTestRunResults ()

さまざまな試行にわたるすべての実行の結果のマージされたコレクションを返します。

複数の結果がある場合、各テスト実行はマージされ、最新のテスト結果が以前の実行のテスト結果を上書きします。テストの実行は試行番号順に並べられます。

同じ試行のメトリクスは、 aggregate-metricsによって設定された設定に基づいてマージされます。最終的なメトリクスは、最後の試行のメトリクスになります。

戻り値

getModuleContextForRunResult

public IInvocationContext getModuleContextForRunResult (String testRunName)

結果に関連付けられたモジュールのIInvocationContextを返します。

パラメーター
testRunName String : { testRunStarted(String, int)によって指定された名前。

戻り値
IInvocationContext指定されたテスト実行名のモジュールのIInvocationContext (その名前に対する結果がない場合はnull

getModuleLogFiles

public MultiMap<String, LogFile> getModuleLogFiles ()

モジュールに関連付けられたすべてのログファイルを含むマップのコピーを返します。

戻り値
MultiMap<String, LogFile>

getNonAssociatedLogFiles

public MultiMap<String, LogFile> getNonAssociatedLogFiles ()

テスト実行またはモジュールに関連付けられていないすべてのログ ファイルを含むマップのコピーを返します。

戻り値
MultiMap<String, LogFile>

getNumAllFailedTestRuns

public int getNumAllFailedTestRuns ()

失敗状態で実行されたテストの合計数を返します。

戻り値
int

getNumAllFailedTests

public int getNumAllFailedTests ()

失敗状態にあるテストの合計数を返します (失敗のみ。想定失敗はカウントされません)。

戻り値
int

getNumTestsInState

public int getNumTestsInState (TestResult.TestStatus status)

この実行で指定された状態にあるテストの数を返します。

パラメーター
status TestResult.TestStatus

戻り値
int

getNumTotalTests

public int getNumTotalTests ()

すべての実行に対する完了したテストの合計数を返します。

戻り値
int

getPrimaryBuildInfo

public IBuildInfo getPrimaryBuildInfo ()

invocationStarted(com.android.tradefed.invoker.IInvocationContext)経由で報告されたプライマリ ビルド情報を返します。プライマリ ビルドは、実行コンフィギュレーションの最初のビルド プロバイダーによって返されるビルドです。コンテキストがない場合 (テスト ケースへのビルドがない場合)、null を返します。

戻り値
IBuildInfo

getRunResults

public  getRunResults ()

このメソッドは廃止されました。
getMergedTestRunResults()を使用する

すべてのテスト実行の結果を返します。

戻り値

getTestRunAttempt

public TestRunResult getTestRunAtAttempt (String testRunName, 
                int attempt)

1 回の試行に対するTestRunResultを返します。

パラメーター
testRunName String : { testRunStarted(String, int)によって指定された名前。

attempt int : 試行 ID。

戻り値
TestRunResult指定された名前と試行 ID のTestRunResult 。存在しない場合はnull

getTestRunAttemptCount

public int getTestRunAttemptCount (String testRunName)

指定されたテスト実行名の試行回数を返します。

パラメーター
testRunName String : { testRunStarted(String, int)によって指定された名前。

戻り値
int

getTestRunAttempts

public  getTestRunAttempts (String testRunName)

指定されたテスト実行のTestRunResultに対するすべての試行を取得します。

パラメーター
testRunName String : { testRunStarted(String, int)によって指定された名前。

戻り値
試行順に並べられた、特定のテスト実行のすべてのTestRunResult

getTestRunForAttempts

public  getTestRunForAttempts (int attempt)

指定された試行に対するすべての結果を取得します。

パラメーター
attempt int : 結果が必要な試行。

戻り値
特定の試行に対するすべてのTestRunResult

getTestRunNames

public  getTestRunNames ()

すべてのテスト実行のすべての名前を返します。

これらのテスト実行は、異なる試行で複数回実行された可能性があります。

戻り値

失敗したテスト

public boolean hasFailedTests ()

呼び出しに失敗したテストまたは仮定に失敗したテストがあった場合に返します。

戻り値
boolean

hasTestRunResultsForName

public boolean hasTestRunResultsForName (String testRunName)

指定されたテスト実行名に結果があるかどうかを返します。

パラメーター
testRunName String : { testRunStarted(String, int)によって指定された名前。

戻り値
boolean

呼び出し終了

public void invocationEnded (long elapsedTime)

パラメーター
elapsedTime long

呼び出し失敗

public void invocationFailed (Throwable cause)

パラメーター
cause Throwable

呼び出し開始

public void invocationStarted (IInvocationContext context)

パラメーター
context IInvocationContext

ログ関連付け

public void logAssociation (String dataName, 
                LogFile logFile)

パラメーター
dataName String

logFile LogFile

setBuildInfo

public void setBuildInfo (IBuildInfo buildInfo)

このメソッドは廃止されました。
もうテストには必要ありません。

ビルド情報を設定します。テストのみに使用してください。

パラメーター
buildInfo IBuildInfo

setMergeStrategy

public void setMergeStrategy (MergeStrategy strategy)

結果をマージするときに使用するMergeStrategyを設定します。

パラメーター
strategy MergeStrategy

テスト仮定失敗

public void testAssumptionFailure (TestDescription test, 
                String trace)

パラメーター
test TestDescription

trace String

テスト仮定失敗

public void testAssumptionFailure (TestDescription test, 
                FailureDescription failure)

パラメーター
test TestDescription

failure FailureDescription

テスト終了

public void testEnded (TestDescription test, 
                long endTime, 
                 testMetrics)

パラメーター
test TestDescription

endTime long

testMetrics

テスト終了

public void testEnded (TestDescription test, 
                 testMetrics)

パラメーター
test TestDescription

testMetrics

テスト失敗

public void testFailed (TestDescription test, 
                FailureDescription failure)

パラメーター
test TestDescription

failure FailureDescription

テスト失敗

public void testFailed (TestDescription test, 
                String trace)

パラメーター
test TestDescription

trace String

テスト無視されました

public void testIgnored (TestDescription test)

パラメーター
test TestDescription

テストモジュール終了

public void testModuleEnded ()

テストモジュールが開始されました

public void testModuleStarted (IInvocationContext moduleContext)

パラメーター
moduleContext IInvocationContext

テスト実行終了

public void testRunEnded (long elapsedTime, 
                 runMetrics)

パラメーター
elapsedTime long

runMetrics

テスト実行失敗

public void testRunFailed (FailureDescription failure)

パラメーター
failure FailureDescription

テスト実行失敗

public void testRunFailed (String errorMessage)

パラメーター
errorMessage String

テスト実行開始しました

public void testRunStarted (String name, 
                int numTests, 
                int attemptNumber)

パラメーター
name String

numTests int

attemptNumber int

テスト実行開始しました

public void testRunStarted (String name, 
                int numTests)

パラメーター
name String

numTests int

テスト実行開始しました

public void testRunStarted (String name, 
                int numTests, 
                int attemptNumber, 
                long startTime)

パラメーター
name String

numTests int

attemptNumber int

startTime long

テスト実行停止

public void testRunStopped (long elapsedTime)

パラメーター
elapsedTime long

テスト開始

public void testStarted (TestDescription test, 
                long startTime)

パラメーター
test TestDescription

startTime long

テスト開始

public void testStarted (TestDescription test)

パラメーター
test TestDescription

保護されたメソッド

クリアモジュールログファイル

protected final void clearModuleLogFiles ()

モジュール ファイルをクリーニングできるため、長時間持ち運ぶことがなくなります。

クリア結果の名前

protected final void clearResultsForName (String testRunName)

指定された実行名の結果をクリアできます。結果の集計など、一部の場合にのみ使用してください。

パラメーター
testRunName String

setIsAggregrateMetrics

protected void setIsAggregrateMetrics (boolean aggregate)

「集計メトリクス」オプションを切り替えます

パラメーター
aggregate boolean