Categories
PostgreSQL Spring

PostgreSQL integration tests using Testcontainers

Running tests against a real database provides more confidence in comparison to an in-memory database such as H2. For that, the Testcontainers library is a wise choice as it provides an out-of-the-box solution to write and run integration tests against an actual database of your choice running in a Docker container. In this tutorial, we […]

Categories
Kotlin Spring

Spring Boot Redis integration test with Testcontainers in Kotlin

Like any other external dependency, we can write integration tests using Testcontainers for a Spring Boot application. However, unfortunately, Testcontainers does not have any library for Redis, and using Kotlin makes it even trickier. In this article, we explore how to write Spring Boot Redis integration test with Testcontainers in Kotlin. Introduction There are two […]

Categories
MySQL Spring

Spring Boot MySQL integration tests with Testcontainers

When it comes to writing database integration tests with Spring Boot, there are two options: an in-memory database or Testcontaienrs. As we already covered Testing Spring Data Repositories with H2 in-memory database, we shift the gear in this article and focus on writing Spring Boot MySQL integration tests with Testcontainers. Introduction Although utilizing an in-memory […]

Categories
Spring

Write Kafka integration test with Testcontainers

Writing a Spring Boot Kafka integration test can be frustrating even by leveraging the spring-kafka-test library that supplies an embedded Kafka. That’s mainly due to the complex test configuration that involves registering consumers and producers to read and write messages. A better approach is to treat Kafka integration tests as a black-box and avoid going […]

Categories
Java

Integration test with Testcontainers in Java

Often times when it comes to integration testing, the recommendation is to write tests as simple as possible. However, this is not usually the case, especially in an event-driven and microservice architecture. Usually, the service under the test has to connect to some external services to perform some tasks. For instance, the service needs to […]

Exit mobile version