I have a set of Junit test cases . All test cases have to be executed for different database environments . When using '@RunWith(SpringJUnit4ClassRunner.class)' in junit test, the spring boot application starts only once . But I need to start the application again with different configurations including flyway migration and other environment related application-<>.properties to run the tests . I have also tried using parameterized tests . In that case too , the spring application gets started only once. Is there any way of achieving this ?
1 Answers
2
votes
Sounds like you need to use these annotations on your tests:
@RunWith(SpringRunner.class)
@SpringBootTest
@Import(MyTestsConfiguration.class)
Refer to this page in the Spring Boot doco for further details