|
Fish & Chips Club 4.10.0.0 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object hirondelle.fish.test.TESTAll
public final class TESTAll
Runs all JUnit tests defined for this application.
To run the tests in the example app, you must perform two edits to reflect your environment:
setRootDirectory()
FakeConnectionSrc
In addition, these tests require the database driver to be present on the classpath.
The recommended style is to place test classes in the same directory as the classes being tested. Such a style will follow the package-by-feature approach, where all items related to a single feature are placed in a single directory - including the unit tests.
These tests are a development tool, and are not typically executed in a deployment environment.
Constructor Summary | |
---|---|
TESTAll()
|
Method Summary | |
---|---|
static void |
actionsUseFakeDAOs(boolean aToggle)
Alter a System property named "useFakeDAOs" |
static void |
initControllerIfNeeded()
Initialize the WEB4J Controller using a FakeServletConfig . |
static void |
main(String[] args)
Run all JUnit tests in the application. |
static void |
setRootDirectory()
Set a System property needed by fake objects to a hard-coded value. |
static junit.framework.Test |
suite()
Return a TestSuite for all unit tests in the application. |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TESTAll()
Method Detail |
---|
public static void main(String[] args) throws ServletException, FileNotFoundException
This method calls initControllerIfNeeded()
.
ServletException
FileNotFoundException
public static void actionsUseFakeDAOs(boolean aToggle)
That system property will control whether or not an Action will
use a fake DAO or a real DAO. See MemberDAO.getInstance()
for
an illustration.
aToggle
- controls whether or not Actions should use fake DAOs.
If true, then a System property named
"useFakeDAOs"
is added with value true; if false, then the same
property is removed.public static void initControllerIfNeeded() throws ServletException, FileNotFoundException
FakeServletConfig
.
This method requires the database driver to be present on the classpath.
This initialization will allow tests for Models, DAOs, and Actions to be run as if they are in the regular runtime enviroment.
This method can be called repeatedly. If called more than once, then it is a no-operation. Thus, this method can be called both by this test suite, and by the individual unit tests. This allows unit tests to run either one at a time, or as part of this suite.
Calling this method mimics the regular runtime environment by passing a FakeServletConfig
to the Controller.init(javax.servlet.ServletConfig)
method. This in turn
uses a FakeConnectionSrc
for fetching connections
without using JNDI.
ServletException
FileNotFoundException
public static void setRootDirectory()
This System property must be set when using the fake objects. An alternative to calling this method is to simply define a -D argument to the JRE.
See FakeServletContext.ROOT_DIRECTORY
for
more information.
public static junit.framework.Test suite()
TestSuite
for all unit tests in the application.
|
Fish & Chips Club 4.10.0.0 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |