ITestLifeCycleReceiver
public interface ITestLifeCycleReceiver
com.android.tradefed.result.ITestLifeCycleReceiver |
インストルメンテーション テストの実行中にイベント通知を受け取ります。
org.junit.runner.notification.RunListener の後にパターン化
呼び出しのシーケンスは次のようになります。
- testRunStarted
- テスト開始
- [テスト失敗]
- [testAssumptionFailure]
- [テスト無視]
- テスト終了
- ....
- [テストの実行に失敗しました]
- testRunEnded
概要
公開メソッド | |
---|---|
default void | testAssumptionFailure ( TestDescription test, String trace) アトミック テストが false の条件を想定していることを示すフラグを立てたときに呼び出されます |
default void | testAssumptionFailure ( TestDescription test, FailureDescription failure) アトミック テストが false の条件を想定していることを示すフラグを立てたときに呼び出されます |
default void | testEnded ( TestDescription test, long endTime, testMetrics) testEnded ( TestDescription test, long endTime, testMetrics) |
default void | testEnded ( TestDescription test, testMetrics) testEnded ( TestDescription test, testMetrics) 個々のテスト ケースの実行終了を報告します。 |
default void | testFailed ( TestDescription test, FailureDescription failure) 個々のテスト ケースの失敗を報告します。 |
default void | testFailed ( TestDescription test, String trace) 個々のテスト ケースの失敗を報告します。 |
default void | testIgnored ( TestDescription test) 通常、テストメソッドに org.junit.Ignore の注釈が付けられているため、テストが実行されない場合に呼び出されます。 |
default void | testRunEnded (long elapsedTimeMillis, runMetrics) testRunEnded (long elapsedTimeMillis, runMetrics) テスト実行の終了を報告します。 |
default void | testRunFailed ( FailureDescription failure) |
default void | testRunFailed (String errorMessage) 致命的なエラーのため、レポートのテスト実行を完了できませんでした。 |
default void | testRunStarted (String runName, int testCount, int attemptNumber) テスト実行の開始を報告します。 |
default void | testRunStarted (String runName, int testCount) テスト実行の開始を報告します。 |
default void | testRunStarted (String runName, int testCount, int attemptNumber, long startTime) テスト実行の開始を報告します。 |
default void | testRunStopped (long elapsedTime) レポートのテスト実行は、ユーザーの要求により完了前に停止しました。 |
default void | testStarted ( TestDescription test, long startTime) |
default void | testStarted ( TestDescription test) 個々のテスト ケースの開始を報告します。 |
公開メソッド
testAssumptionFailure
public void testAssumptionFailure (TestDescription test, String trace)
アトミック テストが false の条件を想定していることを示すフラグを立てたときに呼び出されます
パラメーター | |
---|---|
test | TestDescription : テストを識別します |
trace | String : 失敗のスタック トレース |
testAssumptionFailure
public void testAssumptionFailure (TestDescription test, FailureDescription failure)
アトミック テストが false の条件を想定していることを示すフラグを立てたときに呼び出されます
パラメーター | |
---|---|
test | TestDescription : テストを識別します |
failure | FailureDescription : 失敗とそのコンテキストを説明するFailureDescription 。 |
テスト終了
public 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 void testEnded (TestDescription test,testMetrics)
個々のテスト ケースの実行終了を報告します。
testFailed(TestDescription, FailureDescription)
が呼び出されなかった場合、このテストは成功しました。また、テスト ケースの実行中に発行された可能性のあるキー/値メトリックも返します。
パラメーター | |
---|---|
test | TestDescription : テストを識別します |
testMetrics | ERROR(/Map) |
テスト失敗
public void testFailed (TestDescription test, FailureDescription failure)
個々のテスト ケースの失敗を報告します。
testStarted と testEnded の間で呼び出されます。
パラメーター | |
---|---|
test | TestDescription : テストを識別します |
failure | FailureDescription : 失敗とそのコンテキストを説明するFailureDescription 。 |
テスト失敗
public void testFailed (TestDescription test, String trace)
個々のテスト ケースの失敗を報告します。
testStarted と testEnded の間で呼び出されます。
パラメーター | |
---|---|
test | TestDescription : テストを識別します |
trace | String : 失敗のスタック トレース |
テスト無視
public void testIgnored (TestDescription test)
通常、テストメソッドに org.junit.Ignore の注釈が付けられているため、テストが実行されない場合に呼び出されます。
パラメーター | |
---|---|
test | TestDescription : テストを識別します |
testRunEnded
public void testRunEnded (long elapsedTimeMillis,runMetrics)
テスト実行の終了を報告します。 FIXME: タイプの異なる 2 つの Map<> インターフェイスを持つことはできないため、ここでは HashMap を使用する必要があります。
パラメーター | |
---|---|
elapsedTimeMillis | long : デバイスが報告した経過時間 (ミリ秒) |
runMetrics | Metric でのテスト実行の最後に報告されるキーと値のペア。 |
testRunFailed
public void testRunFailed (FailureDescription failure)
FailureDescription
で説明されているエラーのため、レポートのテスト実行を完了できませんでした。
パラメーター | |
---|---|
failure | FailureDescription : 失敗とそのコンテキストを説明するFailureDescription 。 |
testRunFailed
public void testRunFailed (String errorMessage)
致命的なエラーのため、レポートのテスト実行を完了できませんでした。
パラメーター | |
---|---|
errorMessage | String : 実行失敗の理由を説明する文字String 。 |
testRunStarted
public void testRunStarted (String runName, int testCount, int attemptNumber)
テスト実行の開始を報告します。
パラメーター | |
---|---|
runName | String : テスト実行名 |
testCount | int : テスト実行中のテストの総数 |
attemptNumber | int : 複数回実行される同じ runName の異なる試行を識別する順序番号。 AttemptNumber のインデックスは 0 であり、新しい実行が発生するたびに増加する必要があります。たとえば、テストは詳細に 3 回再試行されます。同じ runName で合計 4 回実行する必要があり、attemptNumber は 0 から 3 です。 |
testRunStarted
public void testRunStarted (String runName, int testCount)
テスト実行の開始を報告します。
パラメーター | |
---|---|
runName | String : テスト実行名 |
testCount | int : テスト実行中のテストの総数 |
testRunStarted
public void testRunStarted (String runName, int testCount, int attemptNumber, long startTime)
テスト実行の開始を報告します。
パラメーター | |
---|---|
runName | String : テスト実行名 |
testCount | int : テスト実行中のテストの総数 |
attemptNumber | int : 複数回実行される同じ runName の異なる試行を識別する順序番号。 AttemptNumber のインデックスは 0 であり、新しい実行が発生するたびに増加する必要があります。たとえば、テストは詳細に 3 回再試行されます。同じ runName で合計 4 回実行する必要があり、attemptNumber は 0 から 3 です。 |
startTime | long : System.currentTimeMillis() を介して測定された、実行が開始された時間 |
testRunStopped
public void testRunStopped (long elapsedTime)
レポートのテスト実行は、ユーザーの要求により完了前に停止しました。
TODO: 現在使用されていません。削除を検討してください
パラメーター | |
---|---|
elapsedTime | long : デバイスが報告した経過時間 (ミリ秒) |
テスト開始
public 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 void testStarted (TestDescription test)
個々のテスト ケースの開始を報告します。古いインターフェースでは、可能な限りtestStarted(com.android.tradefed.result.TestDescription)
を使用する必要があります。
パラメーター | |
---|---|
test | TestDescription : テストを識別します |