Back to Browse

Testcontainers and Spring Boot for local development and integration testing

16.1K views
Streamed live on Jan 25, 2022
1:00:23

We can't believe it either, but in this live stream we welcome, Josh Long. Josh is a Spring Developer Advocate, Java Champion, Kotlin Google Developer Expert, author of numerous books, best-selling video trainer, open-source contributor, podcaster and YouTuber! In this episode we looked at adding integration tests to a Spring Boot application, explored a few approaches how Testcontainers allows to manage the lifecycle of the docker dependencies, like a database, tried Testcontainers Cloud to decouple the environments where tests are run and where docker containers are run, and looked at a demo of a autoservices project. The autoservices integrates with the Spring devtools lifecycle and provides a database (or other dockerized services you need, Kafka, MongoDB, ElasticSearch, etc) using Testcontainers if the app doesn't configure any. You can look at the prototype implementation here: https://github.com/joshlong/testcontainers-auto-services-prototype If you like the idea of auto-services and would like to see it brought to life, please thumbs up and comment on the GitHub issue: https://github.com/spring-projects/spring-boot/issues/29461 If you have any feedback or ideas about how to improve it, please reach out! Contents: 0:00 - Introductions 2:17 - What is Josh working on? 5:58 - Is Java 17 worth it? 11:00 - How Josh tests microservices 13:09 - Building a JDBC example 18:40 - Adding the first test 25:30 - Adding Testcontainers with GenericContainer 30:53 - Using Testcontainers Cloud 33:33 - Setting up correct logging levels 36:30 - Using Testcontainers jdbc url support 40:50 - Looking at Autoservices prototype for local development 48:46 - Explaing how autoservices integrate into Spring devtools 53:44 - Trying autoservices demo in action 57:55 - Final words!

Download

1 formats

Video Formats

360pmp4122.3 MB

Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.

Testcontainers and Spring Boot for local development and integration testing | NatokHD