1

In my spring boot application I have junit test case. I implemented with application listener which will do certain task after server start up. Now I need to run the Junit test case after the bootRun. Basically the application runs like this., I am using gradle build script.

compile->build (running junit test cases)->bootRun

Can we run the test case after bootRun?

Thanks in advance

ArockiaRaj
  • 588
  • 4
  • 17
  • 1
    If I were you, I would look into using the @SpringBootTest annotation on your Junit. This will actually start the application for the context of your unit test, and stop the application after running the test. See here: https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-testing.html#boot-features-testing-spring-boot-applications. Also here: http://www.baeldung.com/spring-boot-testing – Rick Suggs Jun 27 '18 at 14:36

0 Answers0