java - Is there any way to use Spring Boot, Liquibase and an sql-script for integration tests? -


i use liquibase set database schema. disable hibernate create anything. because of that, import.sql ignored. there way configure spring boot or liquibase or other part load test data after liquibase has created tables?

if need crude (i.e, not actual data migrations), can use spring's jdbc initializer in spring boot. in nutshell, you'll need to:

  1. create data-test.sql load data, , place in src/main/resources directory. different environments, use naming convention data-{platform}.sql
  2. add applications-test.properties src/main/resources following: spring.datasource.platform=test # actives data-test.sql above spring.datasource.continueonerror=???? # depends on needs
  3. to active application-test.properties during testing, make sure "test" 1 of profiles that's active during integration test. 1 way annotate test class @activeprofiles({"test", ...}).

Comments