Test Support

Acceptance Test

  • AllCommandsTest. Runs console properties file. This tests commands and the console app.

Test Data

  • K69TestData

Tests using Tests

Tests of a module should not depend on the tests of another module. It may depend on the another module (its source root), of course. Test artifacts that need to be reused in other modules should live in the package test.<package>. As an example, AllCommandsTest is copied when used in other modules but its implementation is just a facde while the core logic is reused from module commons.test.

  • Test Driven Development
  • Junit
  • Book: Next Generation Java Testing: TestNG and Advanced Concepts By Beust, C. & Suleiman, H.
  • Book: Growing Object-Oriented Software, Guided by Tests By Freeman, S. & Pryce, N.

Junit and TestNG

JUnit is best for unit testing.

TestNG has few extra features missing from Junit. Both are well supported by IDEs but Junit is somewhat more popular, mostly being simple by being limited to the simple tests. Complex tests despite excellent tool support start to show diminishing marginal utility in terms of maintenance. But for big and complex projects such tests might be a requirement especially in the light of test-driven development.

  1. Functional testing. But if you really go into that, there are dedicated frameworks for that, e.g., Mockito.
  2. Multi-threaded tests. Junit does not support this. In short, if an exception is thrown on the other thread, junit wil not report it.
  3. More support for data via xmlunit, dbunit, which may have separate frameworks for junit.