Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

NetarchiveSuite specific unit testing guidelines (Note, legacy code might deviate from these guidelines):

  • We used JUnit4 https://github.com/junit-team/junit/wiki JUnit4 for running the unit tests.
  • 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).
  • Test method should be annotated with @test and test classes should be named ${class-to-test}Test to enable the test runner to find the tests. 

An example of a clean unit test with mocked external dependencies and focused test xml document generation can be found in the JobDispatcherTest class.

...