このバージョンはまだ開発中であり、まだ安定しているとは見なされていません。最新の安定バージョンについては、Spring Framework 6.2.12 を使用してください! |
@TestExecutionListeners
@TestExecutionListeners は、アノテーションが付けられたテストクラス、そのサブクラス、そのネストされたクラスのリスナーを登録するために使用されます。リスナーをグローバルに登録する場合は、TestExecutionListener 設定で説明されている自動検出メカニズムを使用して登録する必要があります。
次の例は、2 つの TestExecutionListener 実装を登録する方法を示しています。
Java
Kotlin
@ContextConfiguration
@TestExecutionListeners({CustomTestExecutionListener.class, AnotherTestExecutionListener.class}) (1)
class CustomTestExecutionListenerTests {
// class body...
}| 1 | 2 つの TestExecutionListener 実装を登録します。 |
@ContextConfiguration
@TestExecutionListeners(CustomTestExecutionListener::class, AnotherTestExecutionListener::class) (1)
class CustomTestExecutionListenerTests {
// class body...
}| 1 | 2 つの TestExecutionListener 実装を登録します。 |
デフォルトでは、@TestExecutionListeners は、スーパークラスまたはエンクロージングクラスからリスナーを継承するためのサポートを提供します。例と詳細については、@Nested テストクラスの構成と @TestExecutionListeners javadoc を参照してください。デフォルトの TestExecutionListener 実装の使用に戻す必要があることがわかった場合は、TestExecutionListener 実装の登録の注を参照してください。