Spring Boot Testing - REST API Integration Testing using Testcontainers | Crash Course

Published: 17 January 2022
on channel: Java Guides
23,108
367

In this video tutorial, we will learn how to do Spring Boot application Integration Testing using Testcontainers.

Check out my Spring boot testing Udemy course: https://www.udemy.com/course/testing-...

First, we write Integration tests using a local MySQL database, and then we will address the problem with Testcontainers as a solution.

Chapters:
[04:03] What problem do Testcontainers solve
[06:17] Testcontainers overview
[09:37] Create Spring boot project
[13:16] Configure MySQL Database
[14:56] Create Student JPA entity
[17:56] Create Student JPA Repository
[18:58] Create StudentController and REST APIs
[22:31] Write Integration Test for REST API
[32:58] Run Integration Test
[33:51] What is the problem with Integration Test
[34:44] Adding Testcontainers
[37:21] Integration testing using Testcontainers
[44:52] Using Singleton containers pattern
[48:38] Run Integration Test

SpringBoot provides excellent support for integration testing using @SpringBootTest annotation.

Testcontainers is a Java library that supports JUnit tests, providing lightweight, throwaway instances of common databases, Selenium web browsers, or anything else that can run in a Docker container.

Testcontainer allows us to use Docker containers within our tests. As a result, we can write self-contained integration tests that depend on external resources.

Blog post: https://www.javaguides.net/2022/01/sp...

GitHub repository at https://github.com/RameshMF/springboo...

#springboot #testing #testcontainers


On this page of the site you can watch the video online Spring Boot Testing - REST API Integration Testing using Testcontainers | Crash Course with a duration of hours minute second in good quality, which was uploaded by the user Java Guides 17 January 2022, share the link with friends and acquaintances, this video has already been watched 23,108 times on youtube and it was liked by 367 viewers. Enjoy your viewing!