テスト結果リスナー

public abstract class TestResultListener
extends Object implements ITestLifeCycleReceiver

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


個々のテスト結果のみを気にする実装者向けに ITestLifecycleListener を簡略化したもの。

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

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

まとめ

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

TestResultListener ()

パブリックメソッド

final void testAssumptionFailure ( TestDescription test, String trace)

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

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

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

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

ERROR(/#testEnded(com.android.tradefed.result.TestDescription,Map))の代わりに、終了時刻を直接指定できます。

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, runMetrics) testRunEnded (long elapsedTimeMillis, runMetrics)

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

void testSkipped ( TestDescription test, SkipReason reason)

通常予期しない理由でテストがスキップされ、実行されなかったときに呼び出されます。

final void testStarted ( TestDescription test, long startTime)

testStarted(com.android.tradefed.result.TestDescription)の代わりに、テストの開始時期も指定し、正確な測定のためにERROR(/#testEnded(com.android.tradefed.result.TestDescription,long,Map))と組み合わせます。 。

final void testStarted ( TestDescription test)

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

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

テスト結果リスナー

public TestResultListener ()

パブリックメソッド

テスト仮定失敗

public final void testAssumptionFailure (TestDescription test, 
                String trace)

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

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

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

テスト終了

public final void testEnded (TestDescription test, 
                 testMetrics)

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

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

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

testMetrics : 出力されたメトリクスのERROR(/Map)

テスト終了

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

ERROR(/#testEnded(com.android.tradefed.result.TestDescription,Map))の代わりに、終了時刻を直接指定できます。正確に測定するにはtestStarted(com.android.tradefed.result.TestDescription, long)と組み合わせます。

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

endTime long : System.currentTimeMillis()によって測定されたテスト終了時刻

testMetrics : 出力されたメトリクスのERROR(/Map)

テスト失敗

public final void testFailed (TestDescription test, 
                String trace)

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

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

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

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

テスト無視されました

public final void testIgnored (TestDescription test)

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

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

テスト結果

public abstract void testResult (TestDescription test, 
                TestResult result)

パラメーター
test TestDescription

result TestResult

テスト実行終了

public void testRunEnded (long elapsedTimeMillis, 
                 runMetrics)

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

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

runMetrics : Metricを使用したテスト実行の終了時に報告されたキーと値のペア。

テストスキップされました

public void testSkipped (TestDescription test, 
                SkipReason reason)

通常予期しない理由でテストがスキップされ、実行されなかったときに呼び出されます。これらのテストは、適切な実行を試みるために再試行されます。

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

reason SkipReason : SkipReason

テスト開始

public final void testStarted (TestDescription test, 
                long startTime)

testStarted(com.android.tradefed.result.TestDescription)の代わりに、テストの開始時期も指定し、正確な測定のためにERROR(/#testEnded(com.android.tradefed.result.TestDescription,long,Map))と組み合わせます。 。

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

startTime long : System.currentTimeMillis()によって測定されたテストの開始時刻

テスト開始

public final void testStarted (TestDescription test)

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

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