While unit tests test a specific layer, integration tests are used to test the code in multiple layers. To keep the tests repeatable, we recommend that you use an embedded database instead of a real database for integration tests.
We recommend that you create a separate profile for integration tests using an embedded database. This ensures that each developer has their own database to run the tests against. Let's look at few simple examples.
The application.properties file:
app.profiles.active: production
The application-production.properties file:
app.jpa.database: MYSQL
app.datasource.url: <<VALUE>>
app.datasource.username: <<VALUE>>
app.datasource.password: <<VALUE>>
The application-integration-test.properties file:
app.jpa.database: H2
app.datasource.url=jdbc:h2:mem:mydb
app.datasource...