How to solve Unable to find a @SpringBootConfiguration in your Test

When running Spring Boot tests using annotations like @SpringBootTest or @DataJpaTest, Spring Boot needs to find the main configuration class (annotated with @SpringBootApplication or @Configuration) to set up the application context properly. If Spring Boot cannot find the configuration class, it throws the error “Unable to find a @SpringBootConfiguration,” and the tests fail to execute.

Read more

Testing Spring Boot with TestRestTemplate

TestRestTemplate can be used to send http request in our Spring Boot integration tests. Such tests are usually executed with Spring boot run as a local server in a random port @LocalServerPort. So just need to create the request in integration tests and send it like a clients of your servers. TestRestTemplate have all necessary methods to send the request to server with a convenient way similar to RestTemplate.

Read more

Testing Spring Boot with REST Assured

Spring Boot and REST Assured is a great combination to build and test REST Web services. In this tutorial we will learn how to create a simple REST application and test it with REST Assured Framework.

Read more