@TestExecutionListeners(value={ServletTestExecutionListener.class,DirtiesContextBeforeModesTestExecutionListener.class,DependencyInjectionTestExecutionListener.class,DirtiesContextTestExecutionListener.class,EventPublishingTestExecutionListener.class}) public abstract class AbstractTestNGSpringContextTests extends ObjectSE implements org.testng.IHookable, ApplicationContextAware
ApplicationContext テストサポートと統合する抽象基本テストクラス。 具象サブクラスは通常、クラスレベルの @ContextConfiguration アノテーションを宣言して、アプリケーションコンテキスト リソースの場所またはコンポーネントクラスを構成する必要があります。テストでアプリケーションコンテキストをロードする必要がない場合は、@ContextConfiguration 宣言を省略して、適切な TestExecutionListeners を手動で構成できます。具象サブクラスには、暗黙的または明示的に super(); に委譲するコンストラクターも必要です。
以下の TestExecutionListeners がデフォルトで構成されています。
ContextConfiguration, TestContext, TestContextManager, TestExecutionListeners, ServletTestExecutionListener, DirtiesContextBeforeModesTestExecutionListener, DependencyInjectionTestExecutionListener, DirtiesContextTestExecutionListener, EventPublishingTestExecutionListener, AbstractTransactionalTestNGSpringContextTests, AbstractJUnit4SpringContextTests| 修飾子と型 | フィールドと説明 |
|---|---|
protected ApplicationContext | applicationContextsetApplicationContext(ApplicationContext) を介してこのテストインスタンスに挿入された ApplicationContext。 |
protected Log | logger サブクラスで利用可能なロガー。 |
| コンストラクターと説明 |
|---|
AbstractTestNGSpringContextTests() 新しい AbstractTestNGSpringContextTests インスタンスを作成し、現在のテストクラスの内部 TestContextManager を初期化します。 |
| 修飾子と型 | メソッドと説明 |
|---|---|
void | run(org.testng.IHookCallBack callBack, org.testng.ITestResult testResult) 提供された callback のテストメソッドにデリゲートして実際のテストを実行し、テストの実行中にスローされた例外があれば、それを追跡します。 |
void | setApplicationContext(ApplicationContext applicationContext)ApplicationContextAware セマンティクスを介して提供される、このテストインスタンスによって使用される ApplicationContext を設定します。 |
protected void | springTestContextAfterTestClass()「テスト後」コールバックを呼び出すように構成された TestContextManager にデリゲートします。 |
protected void | springTestContextAfterTestMethod(MethodSE testMethod) 実際のテストの実行後にテストメソッドを後処理するように構成された TestContextManager に委譲します。 |
protected void | springTestContextBeforeTestClass()「テストクラスの前」コールバックを呼び出すように構成された TestContextManager にデリゲートします。 |
protected void | springTestContextBeforeTestMethod(MethodSE testMethod) 実際のテストが実行される前にテストメソッドを前処理するように構成された TestContextManager に委譲します。 |
protected void | springTestContextPrepareTestInstance() 依存関係の注入など、個々のテストを実行する前にこのテストインスタンスを準備するように構成された TestContextManager に委譲します。 |
cloneSE, equalsSE, finalizeSE, getClassSE, hashCodeSE, notifySE, notifyAllSE, toStringSE, waitSE, waitSE, waitSEprotected final Log logger
@Nullable protected ApplicationContext applicationContext
setApplicationContext(ApplicationContext) を介してこのテストインスタンスに挿入された ApplicationContext。public AbstractTestNGSpringContextTests()
AbstractTestNGSpringContextTests インスタンスを作成し、現在のテストクラスの内部 TestContextManager を初期化します。public final void setApplicationContext(ApplicationContext applicationContext)
ApplicationContextAware セマンティクスを介して提供される、このテストインスタンスによって使用される ApplicationContext を設定します。ApplicationContextAware の setApplicationContext applicationContext - このテストが実行される ApplicationContextBeanInitializationException@BeforeClass(alwaysRun=true)
protected void springTestContextBeforeTestClass()
throws ExceptionSETestContextManager にデリゲートします。ExceptionSE - 登録された TestExecutionListener が例外をスローした場合 @BeforeClass(alwaysRun=true,
dependsOnMethods="springTestContextBeforeTestClass")
protected void springTestContextPrepareTestInstance()
throws ExceptionSETestContextManager に委譲します。ExceptionSE - 登録された TestExecutionListener が例外をスローした場合 @BeforeMethod(alwaysRun=true) protected void springTestContextBeforeTestMethod(MethodSE testMethod) throws ExceptionSE
TestContextManager に委譲します。testMethod - 実行しようとしているテストメソッド ExceptionSE - すべての例外の伝播を許可します public void run(org.testng.IHookCallBack callBack,
org.testng.ITestResult testResult)callback のテストメソッドにデリゲートして実際のテストを実行し、テストの実行中にスローされた例外があれば、それを追跡します。org.testng.IHookable の run IHookable.run(IHookCallBack, ITestResult)@AfterMethod(alwaysRun=true) protected void springTestContextAfterTestMethod(MethodSE testMethod) throws ExceptionSE
TestContextManager に委譲します。testMethod - テストインスタンスで実行されたばかりのテストメソッド ExceptionSE - すべての例外の伝播を許可します @AfterClass(alwaysRun=true)
protected void springTestContextAfterTestClass()
throws ExceptionSETestContextManager にデリゲートします。ExceptionSE - 登録された TestExecutionListener が例外をスローした場合