Spring Boot Testing Basics: How to Unit Test & Integration Test REST Controllers

preview_player
Показать описание
In this tutorial, I want to discuss some basics of testing a rest controller in a Spring Boot application. This came up because of a tweet I sent out recently asking developers to stop calling a certain test a unit test. The reason I said this is because whenever you start involving Spring and the whole request & response lifecycle its no longer a unit test. In this demo, I will create a new Spring Boot application, create a simple rest controller and then show you how I would Unit & Integration test that controller. If anything this is just meant to spark a discussion so I would love to hear your thoughts on the subject.

When you have completed this tutorial you should understand:
✅ Create a new Spring Boot Application
✅ Create a new Spring Boot Rest Controller
✅ Create a Unit Test
✅ Create an Integration Test
✅ Run a basic test in a Spring Boot Application
✅ How to use JUnit 5 in a Spring Boot Integration Test

🔗Resources & Links mentioned in this video:

👋🏻Connect with me:

Рекомендации по теме