Skip to content

Latest commit

 

History

History
13 lines (8 loc) · 2.43 KB

README.md

File metadata and controls

13 lines (8 loc) · 2.43 KB

Fast, Reliable Integration Tests with Spring Boot and Flyway

This sample project shows different ways to set up reliable integration tests with Spring Boot, Flyway, and Testcontainers. All other technologies used (JDBC, PostgreSQL, JUnit 5) are interchangeable: Using, for example, Hibernate, MariaDB, and TestNG is possible with the same techniques.

All approaches guarantee that all test cases are independent (start with a fresh database) and do not hide errors (like database rollbacks). Furthermore, the test classes can be executed concurrently1 to take advantage of multicore processors. What varies, however, is their execution speed and how much custom plumbing is necessary.

The performance numbers are indicative. They depend on your hardware and the specifics of your project, for example, the number of Flyway migrations.

Footnotes

  1. The project relies on Gradle's parallel test execution because it uses process isolation to run the tests concurrently. This ensures that tests that run simultaneously do not interfere with each other while keeping the number of running PostgreSQL containers at a reasonable number (one PostgreSQL container per worker process).