Fish & Chips Club 4.10.0.0

hirondelle.fish.test
Class TESTAll

Object
  extended by hirondelle.fish.test.TESTAll

public final class TESTAll
extends Object

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:

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

TESTAll

public TESTAll()
Method Detail

main

public static void main(String[] args)
                 throws ServletException,
                        FileNotFoundException
Run all JUnit tests in the application.

This method calls initControllerIfNeeded().

Throws:
ServletException
FileNotFoundException

actionsUseFakeDAOs

public static void actionsUseFakeDAOs(boolean aToggle)
Alter a System property named "useFakeDAOs"

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.

Parameters:
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.

initControllerIfNeeded

public static void initControllerIfNeeded()
                                   throws ServletException,
                                          FileNotFoundException
Initialize the WEB4J Controller using a 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.

Throws:
ServletException
FileNotFoundException

setRootDirectory

public static void setRootDirectory()
Set a System property needed by fake objects to a hard-coded value.

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.


suite

public static junit.framework.Test suite()
Return a TestSuite for all unit tests in the application.


Fish & Chips Club 4.10.0.0

Copyright Hirondelle Systems - Generated 2013Oct19.12.26