MENU

Fun & Interesting

Master Unit Testing in Spring Boot | JUnit, Mockito | Step-by-Step Tutorial

Genuine Coder 4,542 lượt xem 3 months ago
Video Not Working? Fix It Now

Learn how to write unit tests for your Spring Boot application. This tutorial starts with simple unit tests for basic utility functions and then proceeds to cover detailed functionalities of JUnit, Mockito, and Spring Security test libraries. You'll also discover the benefits of using in-memory databases like H2 for testing, especially in DevOps CI/CD pipelines. This guide is suitable for both beginners and experts looking to master unit testing.

📚 Chapters:
(00:00:00) Introduction
(00:05:29) 1.1. Familiarize with sample project
(00:07:08) 1.2. Write the first unit test
(00:21:26) 1.3. Using @SpyBean for mocking methods
(00:32:36) 2. Unit test for controllers and API endpoints
(00:47:16) 3. Unit test with Spring Security Test | WithMockUser
(00:57:40) 4. Special in-memory database for unit tests

Find the project on GitHub: https://github.com/afsalashyana/Spring-Boot-Tutorials/tree/master/LearnUnitTest
Spring security tutorial: https://youtu.be/9J-b6OlPy24
More Spring boot full courses: https://www.youtube.com/playlist?list=PLhs1urmduZ2-W9wfEktEnSYJWrdoLUdOk

#unittest #mockito #springframework #springboot #java

Comment