BugreportCollector

public class BugreportCollector
extends Object implements ITestInvocationListener

java.lang.Object
com.android.tradefed.result.BugreportCollector


構成可能なイベントが発生したときにバグレポートを収集し、各バグレポートが収集された後にその子でITestInvocationListener#testLogを呼び出すパススルーITestInvocationListener

動作: (FIXME: これを終了してください)

  • テストケースが失敗した場合は毎回キャプチャする
  • 各テストケースの後にキャプチャ
  • テストケースが失敗するたびにキャプチャする
  • 捕獲

まとめ

ネストされたクラス

class BugreportCollector.Predicate

バグレポートを取得するタイミングを説明する完全な述語。

interface BugreportCollector.SubPredicate

田畑

public static final BugreportCollector.Predicate AFTER_FAILED_TESTCASES

テストケースが失敗するたびに起動する定義済みの述語

public static final BugreportCollector.Predicate AT_START

最初の呼び出しの開始時に起動する定義済みの述語

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

BugreportCollector ( ITestInvocationListener listener, ITestDevice testDevice)

公開メソッド

void addPredicate ( BugreportCollector.Predicate p)
void blockUntilIdle ()

コレクターがバグレポートを収集しなくなるまでブロックします。

TestSummary getSummary ()

InvocationListener が要約を返すことを許可します。

void invocationEnded (long elapsedTime)

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

void invocationFailed (Throwable cause)

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

void invocationStarted ( IInvocationContext context)

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

void setAsynchronous (boolean asynchronous)

バグレポート収集でバグレポートを別のスレッドで収集するか ( asynchronous = true )、バグレポートがキャプチャされるまで呼び出し元をブロックするか ( asynchronous = false ) を設定します。

void setDescriptiveName (String name)

バグレポートを記録するときに使用するわかりやすい名前を設定します。

void setDeviceWaitTime (int waitTime)

バグレポートを取得する前に、デバイスがオンラインになるまで待機する時間 (秒単位) を設定します。

void testAssumptionFailure ( TestDescription test, String trace)

アトミック テストが false の条件を想定していることを示すフラグを立てたときに呼び出されます

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

個々のテスト ケースの実行終了を報告します。

void testFailed ( TestDescription test, String trace)

個々のテスト ケースの失敗を報告します。

void testIgnored ( TestDescription test)

通常、テストメソッドに org.junit.Ignore の注釈が付けられているため、テストが実行されない場合に呼び出されます。

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

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

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

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

void testRunFailed (String errorMessage)

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

void testRunStarted (String runName, int testCount)

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

void testRunStopped (long elapsedTime)

レポートのテスト実行は、ユーザーの要求により完了前に停止しました。

void testStarted ( TestDescription test)

個々のテスト ケースの開始を報告します。

田畑

AFTER_FAILED_TESTCASES

public static final BugreportCollector.Predicate AFTER_FAILED_TESTCASES

テストケースが失敗するたびに起動する定義済みの述語

AT_START

public static final BugreportCollector.Predicate AT_START

最初の呼び出しの開始時に起動する定義済みの述語

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

BugreportCollector

public BugreportCollector (ITestInvocationListener listener, 
                ITestDevice testDevice)

パラメーター
listener ITestInvocationListener

testDevice ITestDevice

公開メソッド

addPredicate

public void addPredicate (BugreportCollector.Predicate p)

パラメーター
p BugreportCollector.Predicate

blockUntilIdle

public void blockUntilIdle ()

コレクターがバグレポートを収集しなくなるまでブロックします。コレクタがバグレポートを積極的に収集していない場合は、すぐに戻ります

getSummary

public TestSummary getSummary ()

InvocationListener が要約を返すことを許可します。

戻り値
TestSummary実行を要約するTestSummary 、または null

呼び出し終了

public void invocationEnded (long elapsedTime)

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

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

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

呼び出し失敗

public void invocationFailed (Throwable cause)

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

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

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

呼び出し開始

public void invocationStarted (IInvocationContext context)

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

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

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

setAsynchronous

public void setAsynchronous (boolean asynchronous)

バグレポート収集でバグレポートを別のスレッドで収集するか ( asynchronous = true )、バグレポートがキャプチャされるまで呼び出し元をブロックするか ( asynchronous = false ) を設定します。

パラメーター
asynchronous boolean

setDescriptiveName

public void setDescriptiveName (String name)

バグレポートを記録するときに使用するわかりやすい名前を設定します。 nullの場合、 BugreportCollectorバグレポートが収集される原因となったイベントの名前をシリアル化するデフォルトの動作にフォールバックします。

パラメーター
name String

setDeviceWaitTime

public void setDeviceWaitTime (int waitTime)

バグレポートを取得する前に、デバイスがオンラインになるまで待機する時間 (秒単位) を設定します。負の場合、チェックは実行されません。このチェック中に検出されたDeviceNotAvailableExceptionはログに記録され、無視されます。

パラメーター
waitTime int

testAssumptionFailure

public void testAssumptionFailure (TestDescription test, 
                String trace)

アトミック テストが false の条件を想定していることを示すフラグを立てたときに呼び出されます

パラメーター
test TestDescription : テストを識別します

trace String : 失敗のスタック トレース

テスト終了

public void testEnded (TestDescription test, 
                 testMetrics)

個々のテスト ケースの実行終了を報告します。

testFailed(TestDescription, FailureDescription)が呼び出されなかった場合、このテストは成功しました。また、テスト ケースの実行中に発行された可能性のあるキー/値メトリックも返します。

パラメーター
test TestDescription : テストを識別します

testMetrics : 発行されたメトリックのERROR(/Map)

テスト失敗

public void testFailed (TestDescription test, 
                String trace)

個々のテスト ケースの失敗を報告します。

testStarted と testEnded の間で呼び出されます。

パラメーター
test TestDescription : テストを識別します

trace String : 失敗のスタック トレース

テスト無視

public void testIgnored (TestDescription test)

通常、テストメソッドに org.junit.Ignore の注釈が付けられているため、テストが実行されない場合に呼び出されます。

パラメーター
test TestDescription : テストを識別します

テストログ

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 メソッドが完了するまで、データのソースが存在し、アクセス可能であることを確認する必要があります。

testRunEnded

public void testRunEnded (long elapsedTime, 
                 runMetrics)

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

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

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

testRunFailed

public void testRunFailed (String errorMessage)

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

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

testRunStarted

public void testRunStarted (String runName, 
                int testCount)

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

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

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

testRunStopped

public void testRunStopped (long elapsedTime)

レポートのテスト実行は、ユーザーの要求により完了前に停止しました。

TODO: 現在使用されていません。削除を検討してください

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

テスト開始

public void testStarted (TestDescription test)

個々のテスト ケースの開始を報告します。古いインターフェースでは、可能な限りtestStarted(com.android.tradefed.result.TestDescription)を使用する必要があります。

パラメーター
test TestDescription : テストを識別します