Testing
How to Write and Run Unit Tests
A test is not a unit test if:
- It talks to the database
- It communicates across the network
- It touches the file system
- It can’t run at the same time as any of your other unit tests
- You have to do special things to your environment (such as editing config files) to run it
Unit tests live in the src/test
folder of our sbt projects.
Run all unit tests from terminal:
sbt test
How to Write and Run Integration Tests
Mostly you should consider writing unit tests. These can be executed fast and help developers more in their daily work.
You might need to create an integration test because:
- The test needs to talk to a database
- It requires network
- It is slow and cannot run in parallel with other tests
- You have to do special things to the environment in order to run it
In this case create it in the src/it
source set of our projects.
.NOTE
Currently only the webapi
project supports integration tests.
Run all integration tests from the terminal.
make integration-test
.NOTE The integration tests currently depend on a locally published Sipi container, the make target helps you with that.
Debugging
You can debug unit tests directly in your IDE.
For debugging the integration tests locally with sbt
or your IDE you need to have a fresh SIPI container build:
make docker-build-sipi-image
Last update:
January 19, 2023