I have a SpringBoot MVC application, and I want to cover it with tests.
I have the controller, service and repository layers.
What is the best practice to cover the application by tests?
Why do people use @SpringBootTest
while it seems it could be tested by layers by @WebMvcTest
& @DataJpaTest
and service unit tests? It is faster and more granular, isn't it?
AFAIK when @SpringBootTest
is used it is called Integration tests, so does it mean it shouldn't appear too often?
I suppose that every chunk of code should be unit test covered, is it the same for integration covered? Or should integration tests work on stage environment but not on test environment?
Isn't it the same (in terms of performance) if I create a @SpringBootTest
but mock other layers? (Suppose I create multiple @SpringBootTest
s and mock other layers).