ITestLifeCycleReceiver
public interface ITestLifeCycleReceiver
com.android.tradefed.result.ITestLifeCycleReceiver |
インストルメンテーション テストの実行中にイベント通知を受信します。
org.junit.runner.notification.RunListener の後のパターン
呼び出しのシーケンスは次のようになります。
- テスト実行開始しました
- テスト開始
- [テスト失敗]
- [テスト仮定失敗]
- [テスト無視]
- テスト終了
- ....
- [テスト実行失敗]
- テスト実行終了
まとめ
パブリックメソッド | |
---|---|
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) 個々のテスト ケースの開始を報告します。 |
パブリックメソッド
テスト仮定失敗
public void testAssumptionFailure (TestDescription test, String trace)
アトミック テストが条件が false であると仮定することを示すフラグを立てたときに呼び出されます。
パラメーター | |
---|---|
test | TestDescription : テストを識別します |
trace | String : 失敗のスタック トレース |
テスト仮定失敗
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 : テストを識別します |
テスト実行終了
public void testRunEnded (long elapsedTimeMillis,runMetrics)
テスト実行の終了を報告します。修正: タイプの異なる 2 つの Map<> インターフェイスを使用することはできないため、ここでは HashMap を使用する必要があります。
パラメーター | |
---|---|
elapsedTimeMillis | long : デバイスが報告した経過時間 (ミリ秒単位) |
runMetrics | Metric を使用したテスト実行の終了時に報告されたキーと値のペア。 |
テスト実行失敗
public void testRunFailed (FailureDescription failure)
FailureDescription
で説明されている障害のため、レポートのテスト実行が完了できませんでした。
パラメーター | |
---|---|
failure | FailureDescription : 失敗とそのコンテキストを説明するFailureDescription 。 |
テスト実行失敗
public void testRunFailed (String errorMessage)
レポートのテスト実行は、致命的なエラーのため完了できませんでした。
パラメーター | |
---|---|
errorMessage | String : 実行失敗の理由を説明するString 。 |
テスト実行開始しました
public void testRunStarted (String runName, int testCount, int attemptNumber)
テスト実行の開始を報告します。
パラメーター | |
---|---|
runName | String : テスト実行名 |
testCount | int : テスト実行のテストの総数 |
attemptNumber | int : 順序番号。複数回実行される同じ runName の異なる試行を識別します。 attemptNumber は 0 から始まるインデックスであり、新しい実行が発生するたびに増加する必要があります。たとえば、テストは 3 回詳細に再試行され、同じ runName で合計 4 回の実行が必要で、attemptNumber は 0 ~ 3 です。 |
テスト実行開始しました
public void testRunStarted (String runName, int testCount)
テスト実行の開始を報告します。
パラメーター | |
---|---|
runName | String : テスト実行名 |
testCount | int : テスト実行のテストの総数 |
テスト実行開始しました
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() によって測定された実行の開始時刻 |
テスト実行停止
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 : テストを識別します |