...
- We used JUnit4 https://github.com/junit-team/junit/wiki.
- We used Mockito to mock external dependencies. This requires the class to test to enable dependency injection. Legacy classes without this option might need to be refactored.
- Avoid reading large files from disk with data irrelevant to the test. Instead construct test specific data in the test. See OrderXmlBuilder for example.
- Unit tests are placed in the same module and package as the classes they test under the src/test/java dir (Maven standard).
An example of a clean unit test with mocked external dependencies and focused test xml document generation can be found in the JobDispatcherTest class.
Unit tests are run as part of the general Maven lifecycle, eg. they can be run with:
...
Integration test are generally slower and less robust than pure unit tests.
Junit JUnit4 is also used for integration testing.
Integration tests are run as part of the general Maven test lifecycle. We are considering adding an profile to disable integration test tests to allow running a fast sanity tests test buiæd with only unit tests.
System tests
Runs on against a fully deploy system and validates the end full system functionality together with the manual tests uses during release testing..
The system test is located in the integration test module.
...