TestContextManager
is the main entry point into the Spring TestContext Framework, which provides support for loading and accessing {@link ApplicationContext application contexts}, dependency injection of test instances, {@link org.springframework.transaction.annotation.Transactional transactional} execution of test methods, etc.
Specifically, a TestContextManager
is responsible for managing a single {@link TestContext} and signaling events to all registered{@link TestExecutionListener TestExecutionListeners} at well defined testexecution points:
- {@link #beforeTestClass() before test class execution}: prior to any before class methods of a particular testing framework (e.g., JUnit 4's {@link org.junit.BeforeClass @BeforeClass})
- {@link #prepareTestInstance(Object) test instance preparation}: immediately following instantiation of the test instance
- {@link #beforeTestMethod(Object,Method) before test method execution}: prior to any before methods of a particular testing framework (e.g., JUnit 4's {@link org.junit.Before @Before})
- {@link #afterTestMethod(Object,Method,Throwable) after test methodexecution}: after any after methods of a particular testing framework (e.g., JUnit 4's {@link org.junit.After @After})
- {@link #afterTestClass() after test class execution}: after any after class methods of a particular testing framework (e.g., JUnit 4's {@link org.junit.AfterClass @AfterClass})
@author Sam Brannen
@author Juergen Hoeller
@since 2.5
@see TestContext
@see TestExecutionListeners
@see ContextConfiguration
@see org.springframework.test.context.transaction.TransactionConfiguration