シャードリスナー

public class ShardListener
extends CollectingTestListener implements ISupportGranularResults

java.lang.Object
com.android.tradefed.result.CollectingTestListener
com.android.tradefed.invoker.ShardListener


呼び出しシャード (複数のリソースで並行して実行するための呼び出し分割) から結果を収集し、それらを別のリスナーに転送するITestInvocationListener

まとめ

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

ShardListener ( ITestInvocationListener main)

ShardListenerを作成します。

公開メソッド

getUnderlyingResultReporter ()
void invocationEnded (long elapsedTime)

呼び出しが正常に終了したか、何らかのエラー状態により終了したことを報告します。

void invocationFailed ( FailureDescription failure)

何らかのエラー状態による不完全な呼び出しを報告します。

void invocationFailed (Throwable cause)

何らかのエラー状態による不完全な呼び出しを報告します。

void invocationStarted ( IInvocationContext context)

テスト呼び出しの開始を報告します。

void logAssociation (String dataName, LogFile logFile)

場合によっては、ログをテスト ケースと強く関連付ける必要がありますが、直接testLogSaved(String, com.android.tradefed.result.LogDataType, com.android.tradefed.result.InputStreamSource, com.android.tradefed.result.LogFile)コールバックはできません。

void setSupportGranularResults (boolean enableGranularResults)
boolean supportGranularResults ()

レポーターが詳細な結果をサポートしている場合は True を返し、そうでない場合は False を返します。

void testLog (String dataName, LogDataType dataType, InputStreamSource dataStream)

テスト呼び出しから関連するログまたはデバッグ データを提供します。

void testLogSaved (String dataName, LogDataType dataType, InputStreamSource dataStream, LogFile logFile)

void testModuleEnded ()

モジュール実行の終了を報告します。

void testModuleStarted ( IInvocationContext moduleContext)

実行中のモジュールの開始を報告します。

void testRunEnded (long elapsedTime, runMetrics) testRunEnded (long elapsedTime, runMetrics)

テスト実行の終了を報告します。

void testRunFailed ( FailureDescription failure)

FailureDescriptionで説明されているエラーのため、レポートのテスト実行を完了できませんでした。

void testRunFailed (String failureMessage)

致命的なエラーのため、レポートのテスト実行を完了できませんでした。

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

テスト実行の開始を報告します。

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

シャードリスナー

public ShardListener (ITestInvocationListener main)

ShardListenerを作成します。

パラメーター
main ITestInvocationListener : 結果を転送するITestInvocationListener 。他のShardListenerとの衝突を防ぐために、このオブジェクトは結果を転送するときにmainで同期します。結果は、呼び出しシャードが完了するまで送信されません。

公開メソッド

getUnderlyingResultReporter

public  getUnderlyingResultReporter ()

戻り値

呼び出し終了

public void invocationEnded (long elapsedTime)

呼び出しが正常に終了したか、何らかのエラー状態により終了したことを報告します。

TradeFederation フレームワークによって自動的に呼び出されます。

パラメーター
elapsedTime long : 呼び出しの経過時間 (ミリ秒)

呼び出し失敗

public void invocationFailed (FailureDescription failure)

何らかのエラー状態による不完全な呼び出しを報告します。

TradeFederation フレームワークによって自動的に呼び出されます。

パラメーター
failure FailureDescription : 失敗の原因を説明するFailureDescription

呼び出し失敗

public void invocationFailed (Throwable cause)

何らかのエラー状態による不完全な呼び出しを報告します。

TradeFederation フレームワークによって自動的に呼び出されます。

パラメーター
cause Throwable : ERROR(/Throwable)失敗の原因

呼び出し開始

public void invocationStarted (IInvocationContext context)

テスト呼び出しの開始を報告します。

TradeFederation フレームワークによって自動的に呼び出されます。レポーターは、複数のデバイス レポートをサポートするために、このメソッドをオーバーライドする必要があります。

パラメーター
context IInvocationContext : 呼び出しに関する情報

ログ関連付け

public void logAssociation (String dataName, 
                LogFile logFile)

場合によっては、ログをテスト ケースと強く関連付ける必要がありますが、直接testLogSaved(String, com.android.tradefed.result.LogDataType, com.android.tradefed.result.InputStreamSource, com.android.tradefed.result.LogFile)コールバックはできません。したがって、このコールバックにより、強い関連付けを明示的に提供できます。

パラメーター
dataName String : データの名前

logFile LogFile : 以前にログに記録され、テスト ケースに関連付ける必要があるLogFile

setSupportGranularResults

public void setSupportGranularResults (boolean enableGranularResults)

パラメーター
enableGranularResults boolean

supportGranularResults

public boolean supportGranularResults ()

レポーターが詳細な結果をサポートしている場合は True を返し、そうでない場合は False を返します。

戻り値
boolean

テストログ

public void testLog (String dataName, 
                LogDataType dataType, 
                InputStreamSource dataStream)

テスト呼び出しから関連するログまたはデバッグ データを提供します。

ERROR(/ITestInvocationListener#invocationFailed(Throwable))またはERROR(/ITestInvocationListener#invocationEnded(long))の前に呼び出す必要があります

TradeFederation フレームワークは、このメソッドを自動的に呼び出し、ホスト ログと、該当する場合はデバイスの logcat を提供します。

パラメーター
dataName String : データのERROR(/String)記述名。例: "device_logcat"。注意 dataName は、呼び出しごとに一意ではない場合があります。つまり、実装者は同じ dataName で複数の呼び出しを処理できなければなりません

dataType LogDataType : データのLogDataType

dataStream InputStreamSource : データのInputStreamSource 。実装者は createInputStream を呼び出してデータの読み取りを開始し、完了したら結果の InputStream を確実に閉じる必要があります。呼び出し元は、testLog メソッドが完了するまで、データのソースが存在し、アクセス可能であることを確認する必要があります。

testLogSaved

public void testLogSaved (String dataName, 
                LogDataType dataType, 
                InputStreamSource dataStream, 
                LogFile logFile)

パラメーター
dataName String

dataType LogDataType

dataStream InputStreamSource

logFile LogFile

testModuleEnded

public void testModuleEnded ()

モジュール実行の終了を報告します。

testModuleStarted

public void testModuleStarted (IInvocationContext moduleContext)

実行中のモジュールの開始を報告します。このコールバックはtestModuleEnded()に関連付けられており、シーケンスではオプションです。モジュールを使用する実行中にのみ使用されます: スイートベースのランナー。

パラメーター
moduleContext IInvocationContext : モジュールのIInvocationContext

testRunEnded

public void testRunEnded (long elapsedTime, 
                 runMetrics)

テスト実行の終了を報告します。 FIXME: タイプの異なる 2 つの Map<> インターフェイスを持つことはできないため、ここでは HashMap を使用する必要があります。

パラメーター
elapsedTime long : デバイスが報告した経過時間 (ミリ秒)

runMetrics : Metricでのテスト実行の最後に報告されるキーと値のペア。

testRunFailed

public void testRunFailed (FailureDescription failure)

FailureDescriptionで説明されているエラーのため、レポートのテスト実行を完了できませんでした。

パラメーター
failure FailureDescription : 失敗とそのコンテキストを説明するFailureDescription

testRunFailed

public void testRunFailed (String failureMessage)

致命的なエラーのため、レポートのテスト実行を完了できませんでした。

パラメーター
failureMessage String : 実行失敗の理由を説明するERROR(/String)

testRunStarted

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

テスト実行の開始を報告します。

パラメーター
name String : テスト実行名

numTests int : テスト実行中のテストの総数

attemptNumber int : 複数回実行される同じ runName の異なる試行を識別する順序番号。 AttemptNumber のインデックスは 0 であり、新しい実行が発生するたびに増加する必要があります。たとえば、テストは詳細に 3 回再試行されます。同じ runName で合計 4 回実行する必要があり、attemptNumber は 0 から 3 です。

startTime long : 実行が開始された時間、 ERROR(/System#currentTimeMillis())で測定