I am not good at English. Please understand.
I knew. The use of @SpringBootTest()
Annotation to load the entire Bean was clearly thought of as an "Integration Test.
"
However, the use of @SpringBootTest(classes=mybean.class)
was thought to be "Unit Test" because it only runs a certain (selected) "Bean(Class)
" although it runs a spring.
I also thought the way to use @ContextConfiguration" was also "Unit Tests.
" Because I thought only certain classes could be executed, such as @ContextConfusion(classes=myBean.class)
.
But it was my mistake. I received an answer to the last StackOverflow.
@SpringBootTest vs @ContextConfiguration vs @Import in Spring Boot Unit Test
My last question-->
Whether using @ContextConfiguration
can be a "Unit Test"
$$$answer --->
No, it cannot, it's an integration test that runs only one class in spring.
Usually, we don't run only one class with Spring Framework. What is the benefit of running it inside the spring container if you only want to test the code of one class (a unit)? Yes, in some cases it can be a couple of classes, but not tens or hundreds.
If you run one class with spring then, in any case, you'll have to mock all its dependencies, the same can be done with mockito...
So I ask again.
Is "@WebMvcTest
" also "Integration Tests
"? I thought "@WebMvcTest
" was the "Unit Test
." However, based on the last answer, @WebMvcTest
also has spring running. So the logic of the last answer is that "@WebMvcTest
" is also "Integration Test
," but I still don't understand.
I'm confused. Am I just playing with words?
- Unit Test vs Integration Test...
- Is the
@WebMvcTest
also an "Integration Test
"?