Connect relies on a number of test steps:
- maven integration tests (unit tests are supported)
- circleci continuous integration link on commits and pull requests
- codecov coverage reports link generated with jacoco
In addition to the integration testing and coverage reporting done by circleci developers are also expected to test their changes locally. The maven commands are:
- run unit tests only:
target/, run unit tests and then integration tests:
mvn clean verify
During integration testing an included neo4j server will automatically be started. An error will be thrown if a unit test case tries to access a route that queries the database. The database is not ephemeral, but lives in the
target/ directory. Most tests will create stuff in the database and will run into problems if entries, collections or users already exists. This is why it is recommended to run
Writing test cases¶
The connect backend is tested using the pippo module
There are some additional modules that are used to facilitate easier testing of expected behaviour.
- Some API actions will send an email. It is possible to use a mock
MailClient, such as
Mailboxto capture and verify mails.
URLParserclass helps with link extraction.
Detecting test files¶
A test file is run during unit testing if it matches
Integration tests are matched with