|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.test.context.testng.AbstractTestNGSpringContextTests
@TestExecutionListeners(value={DependencyInjectionTestExecutionListener.class,DirtiesContextTestExecutionListener.class}) public abstract class AbstractTestNGSpringContextTests
Abstract base test class which integrates the
Spring TestContext Framework with explicit
ApplicationContext
testing support in a TestNG
environment.
Concrete subclasses:
@ContextConfiguration
annotation to configure the
application context
resource locations
.
If your test does not need to load an application context, you may choose
to omit the @ContextConfiguration
declaration
and to configure the appropriate
TestExecutionListeners
manually.super();
.
TestContext
,
TestContextManager
,
TestExecutionListeners
,
AbstractTransactionalTestNGSpringContextTests
,
AbstractJUnit38SpringContextTests
,
AbstractJUnit4SpringContextTests
Field Summary | |
---|---|
protected ApplicationContext |
applicationContext
The ApplicationContext that was injected into this test instance
via setApplicationContext(ApplicationContext) . |
protected Log |
logger
Logger available to subclasses |
Constructor Summary | |
---|---|
AbstractTestNGSpringContextTests()
Construct a new AbstractTestNGSpringContextTests instance and initialize the internal TestContextManager for the current test. |
Method Summary | |
---|---|
void |
run(org.testng.IHookCallBack callBack,
org.testng.ITestResult testResult)
Delegates to the test
method in the supplied callback to execute the actual test
and then tracks the exception thrown during test execution, if any. |
void |
setApplicationContext(ApplicationContext applicationContext)
Set the ApplicationContext to be used by this test instance,
provided via ApplicationContextAware semantics. |
protected void |
springTestContextAfterTestClass()
Delegates to the configured TestContextManager to call
'after test class' callbacks. |
protected void |
springTestContextAfterTestMethod(Method testMethod)
Delegates to the configured TestContextManager to
post-process the test method after the actual test has executed. |
protected void |
springTestContextBeforeTestClass()
Delegates to the configured TestContextManager to call
'before test class'
callbacks. |
protected void |
springTestContextBeforeTestMethod(Method testMethod)
Delegates to the configured TestContextManager to
pre-process
the test method before the actual test is executed. |
protected void |
springTestContextPrepareTestInstance()
Delegates to the configured TestContextManager to
prepare this test
instance prior to execution of any individual tests, for example for
injecting dependencies, etc. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final Log logger
protected ApplicationContext applicationContext
ApplicationContext
that was injected into this test instance
via setApplicationContext(ApplicationContext)
.
Constructor Detail |
---|
public AbstractTestNGSpringContextTests()
TestContextManager
for the current test.
Method Detail |
---|
public final void setApplicationContext(ApplicationContext applicationContext)
ApplicationContext
to be used by this test instance,
provided via ApplicationContextAware
semantics.
setApplicationContext
in interface ApplicationContextAware
applicationContext
- the applicationContext to setBeanInitializationException
protected void springTestContextBeforeTestClass() throws Exception
TestContextManager
to call
'before test class'
callbacks.
Exception
- if a registered TestExecutionListener throws an
exceptionprotected void springTestContextPrepareTestInstance() throws Exception
TestContextManager
to
prepare
this test
instance prior to execution of any individual tests, for example for
injecting dependencies, etc.
Exception
- if a registered TestExecutionListener throws an
exceptionprotected void springTestContextBeforeTestMethod(Method testMethod) throws Exception
TestContextManager
to
pre-process
the test method before the actual test is executed.
testMethod
- the test method which is about to be executed.
Exception
- allows all exceptions to propagate.public void run(org.testng.IHookCallBack callBack, org.testng.ITestResult testResult)
test
method
in the supplied callback
to execute the actual test
and then tracks the exception thrown during test execution, if any.
run
in interface org.testng.IHookable
IHookable.run(org.testng.IHookCallBack,
org.testng.ITestResult)
protected void springTestContextAfterTestMethod(Method testMethod) throws Exception
TestContextManager
to
post-process
the test method after the actual test has executed.
testMethod
- the test method which has just been executed on the
test instance
Exception
- allows all exceptions to propagateprotected void springTestContextAfterTestClass() throws Exception
TestContextManager
to call
'after test class'
callbacks.
Exception
- if a registered TestExecutionListener throws an
exception
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |