Spring Boot – How do you test your controllers?
Hey there! Welcome to this new blog post!
- Integration testing
- Unit testing
1) Integration testing
Integration testing means we test a part of a system and its modules together as a group. We do not isolate the different modules that belong in a certain flow. Instead, we make sure to test all of them and check if we get the desired outcome.
For instance, looking at this common flow:
HTTP request -> Controller -> Service -> Repository -> Data
we would test the system from the front to the back including every layer along the flow.
2) Unit testing
Unit testing means that we test every module of a particular system flow in isolation as a “unit”, hence the name Unit Testing.
- the controller
- the service
- the repository.
In the following, I will explain how this is achievable in the Spring Boot framework and what modules have to be used.
Verder lezen:
https://blog.codecentric.nl/mitchelwijt/spring-boot-how-do-you-test-your-controllers-2aj3