Reputation: 1418
I need to add tests to my Spring Boot project. With rails framework there is dev and test databases which are created when new project is started. Migrations are applied to both databases to keep the database schemas equal. Unfortunately I didn't find the documentation on how to configure test environment database in Spring boot and how to get the database structure equal to dev.
What is the best practice for testing in Spring Boot? How to setup and add test-data for the test environment? Is there any examples?
Upvotes: 2
Views: 4046
Reputation: 6549
You can use profiles in spring which allow to use different configuration. So in DEV Profile you tell spring you want to point to dev database but in TEST Profile run in another database.
Check this link: http://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-profiles.html
If you want to manage delta scripts you can use flyway or liquibase. Both are supported by spring-boot.
Upvotes: 4