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

preview_player
Показать описание
In this video tutorial, we will learn how to do Spring Boot application Integration Testing using Testcontainers.

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.

#springboot #testing #testcontainers
Рекомендации по теме
Комментарии
Автор

85% discount on my new course on Udemy: Testing Spring Boot Application with JUnit and Mockito (Includes Testcontainers)
Don't miss the early bird offer.
Use

JavaGuides
Автор

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

JavaGuides
Автор

@Java Guide Are you sure that above example is actually using TestContainer database ? I think it's using local database running your system while executing the test cases.

sanjitguin
Автор

Wow it's something new to learn 🙏

javatechnology
Автор

Hey man
If I have 3 roles admin manager and emplyee
and I have 3 features/domains: Auth, User, Task

Should I test by role or by domain? I mean should I test typical scenario for employee etc.or task?

fuukowatty
Автор

How do I do an integration test for a route protected with SAML

okeyximo
visit shbcf.ru