Spring Boot Testing part 2: Integration Testing with Testcontainers

preview_player
Показать описание
In this video I demonstrate how to use the Spring application context together with a Postgres Testcontainer in Spring Boot integration tests.

The Spring Boot application context is created using the SpringBootBest annotation which allows us to autowire beans in the test.

TestContainers make it possible to use Docker containers in integration testing which is extremely beneficial because it allows for parity between dependancies in tests and production. For example instead of using an in-memory database in my tests, I can use the same database container as the database I have in production.

@DockerInc @SpringSourceDev

#docker #integrationtesting #springboot #postgres #postgresql

Timecodes:
0:00 - Integration test introduction
0:38 - Integration test project walkthrough
1:15 - Walk-through of the Integration test configuration
1:55 - Integration test Class creation
3:15 - Integration test URL creation
4:15 - Integration test Method creation
8:40 - Testcontainers Intro
9:25 - Add Testcontainers dependency
10:08 - Implement the Postgres Testcontainer
14:06 - Run Integration Test
Рекомендации по теме
welcome to shbcf.ru