Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Levels of test

Unit tests

A unit test is an automatically run test of a single class with a number of test methods. Unit tests should be small, run quickly and automatically, not depend on external resources, and not prevent other unit tests from running.

For further information on writing unit test in general, see:

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

  • 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.
  • Unit tests are placed in the same module and package as the classes they test under the src/test/java dir (Maven standard).

Unit tests are run as part of the general Maven lifecycle, eg. they can be run with: 

mvn test

Integration tests

Integration tests are tests which investigate how several classes or external systems work together. This can be Dao class tests which run on top of a real database, MQ or heritrix tests.

Integration test are generally slower and less robust than pure unit tests. 

Junit is also used for integration testing.

Integration tests are run as part of the general Maven test lifecycle. We are considering an profile to disable integration test to allow running fast sanity tests with only unit tests.

System tests

Runs on a fully deploy system and validates the end system functionality together with the manual tests uses during release testing.

The system test is located in the integration test module.

See System test procedure for details on how to run the system tests. 

 

 

  • No labels