TestContainers with SpringBoot and PostgreSQL

In this tutorial, we’ll walk through setting up a Spring Boot 3 application to use TestContainers for integration testing with PostgreSQL. TestContainers provides lightweight, disposable instances of databases and other services, which are essential for reliable and reproducible integration tests.

Read more

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

How to Run JUnit 5 Tests with Spring Boot

If you’re building a Spring Boot application, you’ll likely want to test your code to ensure it’s working as expected. JUnit 5 is a powerful testing framework that makes it easy to write and run tests in Java. In this tutorial, we’ll show you how to run JUnit 5 tests with Spring Boot, including how … 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