| org.ddsteps.spring.DDStepsSpringTestCase
All known Subclasses: org.ddsteps.spring.DdSpringTestCase,
DDStepsSpringTestCase | abstract public class DDStepsSpringTestCase extends AbstractDependencyInjectionSpringContextTests implements DdTestCaseHooks(Code) | | Spring Dependency Injection TestCase that is data driven.
You need the following stuff in your context:
By default, a context xml file called "ddsteps-context.xml" in the root of
your classpath.
By default, the context is only loaded once, so you can probably use the same
context for all your test, even if you don't happen to need a datasource in
every test.
Known drawbacks when using this class:
- The test case count is not correct, as the behaviour is not available
until after setup, so it just returns 1.
author: Adam Skogman since: 1.1 version: $Id$ |
Constructor Summary | |
public | DDStepsSpringTestCase() Force a default constructor, so that subclasses don't have to mess with
the name. |
Method Summary | |
final public int | countTestCases() | DdBehaviour | getBehaviour() Get the behaviour for this instance. | protected String[] | getConfigLocations() Default is to load the context from ddsteps-config.xml in the root of the
classpath. | protected String | getDataLoaderBeanName() Subclasses may override this if they don't want their DataLoader pulled
from the context by the name of "dataLoader". | public String | getName() Returns the FULL data driven testcase name. | final protected void | onSetUp() When we get here, the dependency injection will have happened. | final protected void | onTearDown() | final public void | run(TestResult result) Override, delegates to behaviour. | final public void | setName(String name) Overrides the name setter. | public void | setUpAfterData() Override this in your subclass, if desired. | public void | setUpBeforeData() Override this in your subclass, if desired. | public void | setUpMethod() Override this in your subclass, if desired. | final void | superSetUp() Expose the setUp in the superclass for DdBehaviour callback to use. | final void | superTearDown() Expose the tearDown in the superclass for DdBehaviour callback to use. | public void | tearDownAfterData() Override this in your subclass, if desired. | public void | tearDownBeforeData() Override this in your subclass, if desired. | public void | tearDownMethod() Override this in your subclass, if desired. |
DEFAULT_BEAN_NAME_DATA_LOADER | final public static String DEFAULT_BEAN_NAME_DATA_LOADER(Code) | | Constant: The default bean name for your DataLoader
|
DEFAULT_CONTEXT_XML | final public static String DEFAULT_CONTEXT_XML(Code) | | Constant: The default spring context loaded by DDSteps.
|
behaviour | DdBehaviour behaviour(Code) | | Delegate: The Behaviour delegate.
This will not be dependency injected by default, as there is no setter
and the field is not protected.
Always get the behaviour using the getBehaviour() method.
|
callbackHandler | final protected DdBehaviourCallbackHandler callbackHandler(Code) | | Inner class, will simply delegate all calls back to the parent. Needed
since setUp() and tearDown() are not public in Springs testcase.
|
fullName | String fullName(Code) | | Property: The FULL name of this data driven testcase, i.e. testMethod[Row
13] if a row instance.
|
DDStepsSpringTestCase | public DDStepsSpringTestCase()(Code) | | Force a default constructor, so that subclasses don't have to mess with
the name. JUnit will always call setName(), well, TestSuite will do that
actually.
|
countTestCases | final public int countTestCases()(Code) | | See Also: junit.framework.Test.countTestCases |
getBehaviour | DdBehaviour getBehaviour()(Code) | | Get the behaviour for this instance. The behaviour is cached, once
loaded.
When getting the behaviour, the dataloader will be looked up from the
spring context.
A behaviour, never null. |
getConfigLocations | protected String[] getConfigLocations()(Code) | | Default is to load the context from ddsteps-config.xml in the root of the
classpath.
See Also: org.springframework.test.AbstractDependencyInjectionSpringContextTests.getConfigLocations |
getDataLoaderBeanName | protected String getDataLoaderBeanName()(Code) | | Subclasses may override this if they don't want their DataLoader pulled
from the context by the name of "dataLoader".
Bean name of the DataLoader. |
getName | public String getName()(Code) | | Returns the FULL data driven testcase name.
A string, null if setName() has not been called. |
onSetUp | final protected void onSetUp() throws Exception(Code) | | When we get here, the dependency injection will have happened.
See Also: org.springframework.test.AbstractDependencyInjectionSpringContextTests.onSetUp |
onTearDown | final protected void onTearDown() throws Exception(Code) | | See Also: org.springframework.test.AbstractDependencyInjectionSpringContextTests.onTearDown |
run | final public void run(TestResult result)(Code) | | Override, delegates to behaviour.
See Also: junit.framework.Test.run(junit.framework.TestResult) |
setName | final public void setName(String name)(Code) | | Overrides the name setter. Behaviour is cleared when name is reset.
See Also: junit.framework.TestCase.setName(java.lang.String) |
superSetUp | final void superSetUp() throws Exception(Code) | | Expose the setUp in the superclass for DdBehaviour callback to use.
throws: Exception - |
superTearDown | final void superTearDown() throws Exception(Code) | | Expose the tearDown in the superclass for DdBehaviour callback to use.
throws: Exception - |
|
|