TestResultListener

public abstract class TestResultListener
extends Object implements ITestLifeCycleReceiver

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


個々のテスト結果のみに関心がある実装者向けの ITestLifecycleListener の簡略化。

さまざまなライフサイクル イベントをフィルタして testResult メソッドに絞り込みます。

スレッドセーフではありません。特に、ITestLifecycleListener イベントが 順番に受信されることを前提としています。

概要

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

TestResultListener()

パブリック メソッド

final void testAssumptionFailure(TestDescription test, String trace)

アトミック テストで、誤った条件を想定していることが示された場合に呼び出されます。

final void testEnded(TestDescription test, long endTime, Map<String, String> testMetrics)

testEnded(TestDescription,Map) の代替。終了時間を直接指定できます。

final void testEnded(TestDescription test, long endTime, HashMap<String, MetricMeasurement.Metric> testMetrics)

testEnded(TestDescription,Map) の代替。終了時間を直接指定できます。

final void testEnded(TestDescription test, Map<String, String> testMetrics)

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

final void testEnded(TestDescription test, HashMap<String, MetricMeasurement.Metric> testMetrics)

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

final void testFailed(TestDescription test, String trace)

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

final void testIgnored(TestDescription test)

テストが実行されない場合に呼び出されます。通常、テストメソッドに org.junit.Ignore. のアノテーションが付けられていることが原因です。

abstract void testResult(TestDescription test, TestResult result)
void testRunEnded(long elapsedTimeMillis, HashMap<String, MetricMeasurement.Metric> runMetrics)

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

void testSkipped(TestDescription test, SkipReason reason)

通常は想定されない理由でテストがスキップされ、実行されなかった場合に呼び出されます。

final void testStarted(TestDescription test, long startTime)

testStarted(TestDescription) の代替。テストが開始された時刻も指定します。正確な測定を行うため、testEnded(TestDescription,long,Map) と組み合わせます。

final void testStarted(TestDescription test)

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

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

TestResultListener

public TestResultListener ()

パブリック メソッド

testAssumptionFailure

public final void testAssumptionFailure (TestDescription test, 
                String trace)

アトミック テストで、誤った条件を想定していることが示された場合に呼び出されます。

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

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

testEnded

public final void testEnded (TestDescription test, 
                long endTime, 
                Map<String, String> testMetrics)

testEnded(TestDescription,Map) の代替。終了時間を直接指定できます。正確な測定を行うため、testStarted(TestDescription,long) と組み合わせます。

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

endTime long: テストが終了した時刻。System.currentTimeMillis() で測定します。

testMetrics Map: 出力された指標の Map

testEnded

public final void testEnded (TestDescription test, 
                long endTime, 
                HashMap<String, MetricMeasurement.Metric> testMetrics)

testEnded(TestDescription,Map) の代替。終了時間を直接指定できます。正確な測定を行うため、testStarted(TestDescription,long) と組み合わせます。

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

endTime long: テストが終了した時刻。System.currentTimeMillis() で測定します。

testMetrics HashMap: 出力された指標の Map

testEnded

public final void testEnded (TestDescription test, 
                Map<String, String> testMetrics)

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

testFailed(TestDescription, FailureDescription) が呼び出されなかった場合、このテストは合格しています。また、テストケースの実行中に出力された Key-Value 指標も返します。

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

testMetrics Map: 出力された指標の Map

testEnded

public final void testEnded (TestDescription test, 
                HashMap<String, MetricMeasurement.Metric> testMetrics)

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

testFailed(TestDescription, FailureDescription) が呼び出されなかった場合、このテストは合格しています。また、テストケースの実行中に出力された Key-Value 指標も返します。

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

testMetrics HashMap: 出力された指標の Map

testFailed

public final void testFailed (TestDescription test, 
                String trace)

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

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

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

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

testIgnored

public final void testIgnored (TestDescription test)

テストが実行されない場合に呼び出されます。通常、テストメソッドに org.junit.Ignore のアノテーションが付けられていることが原因です。

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

testResult

public abstract void testResult (TestDescription test, 
                TestResult result)

パラメータ
test TestDescription

result TestResult

testRunEnded

public void testRunEnded (long elapsedTimeMillis, 
                HashMap<String, MetricMeasurement.Metric> runMetrics)

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

パラメータ
elapsedTimeMillis long: デバイスから報告された経過時間(ミリ秒単位)。

runMetrics HashMap: Metric を使用してテスト実行の終了時に報告された Key-Value ペア。

testSkipped

public void testSkipped (TestDescription test, 
                SkipReason reason)

通常は想定されない理由でテストがスキップされ、実行されなかった場合に呼び出されます。 これらのテストは、適切に実行されるように再試行されます。

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

reason SkipReason: SkipReason

testStarted

public final void testStarted (TestDescription test, 
                long startTime)

testStarted(TestDescription) の代替。テストが開始された時刻も指定します。正確な測定を行うため、testEnded(TestDescription,long,Map) と組み合わせます。

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

startTime long: テストが開始された時刻。System.currentTimeMillis() で測定します。

testStarted

public final void testStarted (TestDescription test)

個々のテストケースの開始を報告します。古いインターフェースです。可能な限り testStarted(TestDescription) を使用してください。

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