One of the main reasons for popularity of SpringBoot is its amazing support for Testing.
In addition to writing unit tests for verifying the core business logic, Spring/SpringBoot provides support for testing Web Controllers and Spring Data Repositories as well using Slice Test annotations such as @WebMvcTest, @DataJpaTest etc. Also, we can write integration tests using @SpringBootTest annotation.
#sivalabs #java #springboot #tips #testing
In this video we are going to learn:
1. How to write Unit Tests using Mockito
2. How to Unit Test Web Controller
3. How to Unit Test Spring Data JPA Repository
4. How to Integration Test end-to-end flow.
In addition to this we are going talk about some good practices of testing as well.
Timestamps
00:00 Intro to SpringBoot Tips Part 4 - Testing
00:40 Types of tests for 3-tier applications
03:39 Project Setup that we are going to test
07:16 Write Unit Tests using Mockito
17:35 Write Web Slice Test for Controllers
24:10 Write Repository Slice Tests for Spring Data JPA Repository
33:30 Write Integration Tests
36:52 A common mistake developers do while writing Controller tests
40:10 Summary
🚀 SpringBoot Tips Series Playlist • Spring Boot Tips
Blog: sivalabs.in
Twitter: / sivalabs
Sample Code: github.com/sivaprasadreddy/si...
21 июл 2024