org.kuali.rice.test
Class BaselineTestCase
java.lang.Object
org.kuali.rice.test.BaseRiceTestCase
org.kuali.rice.test.RiceTestCase
org.kuali.rice.test.RiceInternalSuiteDataTestCase
org.kuali.rice.test.BaseModuleTestCase
org.kuali.rice.test.BaselineTestCase
- All Implemented Interfaces:
- MethodAware
public class BaselineTestCase
- extends BaseModuleTestCase
Test case which supports common styles of "baselining" the test environment before/after running
a unit test.
Currently supports three modes, which are specifyiable either via constructor, getMode()
override,
or by annotation:
- NONE
- No baselining is performed. Because the base RiceTestCase includes the ClearDatabaseLifecycle by default, this lifecycle is
explicitly omitted
- CLEAR_DB
- The database is cleared for each test. The suite ClearDatabaseLifecycle is omitted (since it's getting cleared each test
anyway)
- ROLLBACK_CLEAR_DB
- A TransactionalLifecycle is installed that wraps each test and rolls back data. The suite ClearDatabaseLifecycle will be
invoked once initially, and subsequently if the test has detected that the environment has been left "dirty" by a previous
test. After a successful rollback, the test environment is marked clean again.
- A TransactionalLifecycle is installed that wraps each test and rolls back data.
The BaselineMode annotation can be used on a per-test-class basis to indicate to the base class which mode to use for test
subclass. It accepts a BaselineTestCase.Mode
value.
- Author:
- Kuali Rice Team (rice.collab@kuali.org)
Field Summary |
protected static boolean |
dirty
Whether the test environment is in a "dirty" state. |
Methods inherited from class org.kuali.rice.test.RiceTestCase |
configureLogging, dumpMemory, getBaseDir, getConfigLocations, getFullTestName, getLoadApplicationLifecycle, getModuleTestConfigLocation, getRiceMasterDefaultConfigFile, getSuiteLifecycles, getTestHarnessConfig, getTestHarnessSpringBeansLocation, getTestHarnessSpringResourceLoader, getUserDir, loadPerTestData, logAfterRun, logBeforeRun, report, setBaseDirSystemProperty, setClearTables, setModuleName, setUpInternal, startLifecycles, startSuiteDataLoaderLifecycles, stopLifecycles, tearDown |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
dirty
protected static boolean dirty
- Whether the test environment is in a "dirty" state. Each time the unit test starts up
dirty is set to true. If a subclass installs the
TransactionalLifecycle
then
it should clear the dirty flag. This flag can be used to perform cleanup in case a previous
test left the test environment in a "dirty" state.
BaselineTestCase
public BaselineTestCase(String moduleName)
BaselineTestCase
public BaselineTestCase(String moduleName,
BaselineTestCase.Mode mode)
- Adds the ability to specify Mode
getMode
protected BaselineTestCase.Mode getMode()
- Returns:
- the configured mode
setUp
public void setUp()
throws Exception
- Overridden to set dirty=true each time
- Overrides:
setUp
in class RiceTestCase
- Throws:
Exception
- See Also:
RiceTestCase.setUp()
getPerTestLifecycles
protected List<Lifecycle> getPerTestLifecycles()
- Overrides:
getPerTestLifecycles
in class RiceTestCase
- Returns:
- Lifecycles run every test run
getClearDbPerTestLifecycles
protected List<Lifecycle> getClearDbPerTestLifecycles()
- Returns:
- the per-test lifecycles for clearing the database
getPerTestTablesToClear
protected List<String> getPerTestTablesToClear()
getPerTestTablesNotToClear
protected List<String> getPerTestTablesNotToClear()
getRollbackClearDbPerTestLifecycles
protected List<Lifecycle> getRollbackClearDbPerTestLifecycles()
- Returns:
- the per-test lifecycles for rolling back & clearing the database
getRollbackTestLifecycles
protected List<Lifecycle> getRollbackTestLifecycles()
- Returns:
- the per-test lifecycles for rolling back the database
Copyright © 2005-2014 The Kuali Foundation. All Rights Reserved.