...
- All levels of abstraction are involved in tests, it means all of them are impacting on test results same way as within
a deployed application - JPA repositories are subjects of test
- Complete validation of expected behavior, including database schema initialization
- Can be used on build, keeping desired level of reliability and consistency
- Tests can be used on development stage making the database deployment (on dev environment) optional
Components
Components used to serve the integration tests are shown on diagram below.
draw.io Diagram | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
- Docker provides a container with running database instance which is used during the test
- Test container component communicates with Docker via CLI, manages required container to be created/started
before test and stopped/removed after the test is completed - Test container component is used by JUnit test as a Class Rule
- The connection to test database is served using standard Spring framework components
Test Containers
Test container life circle management
...