Unit Tests

Running from the command line

  • cd to the application/ directory
  • Run all the unit tests: mvn clean test
  • Run one test: mvn test -Dtest=TheNameOfYourTestClass
  • Run from Eclipse: right click on test class > Run As > JUnit Test

Developing Unit Tests

  • Under no circumstances the unit tests should touch the database! Use mock objects or in-memory implementations. The unit tests need to run quickly, and touching a database makes them slow and fragile.
  • NOTE: Only unit tests are not enough to confirm that build is not broken after a change in main code, hence you should always consider running all the tests by mvn clean install
  • Test classes with naming pattern _IntegrationTest or _StrutsTest are integration tests, excluding these all are unit tests in application module.

Also see Application Module & Integration Tests.