Performance: @SpringBootTest for integration tests
MEDIUM IMPACT
This affects the test execution time and resource usage during integration testing, impacting developer feedback speed and CI pipeline duration.
@SpringBootTest(classes = MyServiceConfig.class) public class MyServiceTest { @Autowired private MyService service; @Test void testService() { // test logic } }
@SpringBootTest
public class MyServiceTest {
@Autowired
private MyService service;
@Test
void testService() {
// test logic
}
}| Pattern | Context Load Time | Memory Usage | Test Execution Speed | Verdict |
|---|---|---|---|---|
| Full @SpringBootTest | High (1-3s per test class) | High | Slow | [X] Bad |
| @SpringBootTest with limited config | Medium (0.3-1s) | Medium | Faster | [!] OK |
| Slice test annotations (e.g., @WebMvcTest) | Low (<0.5s) | Low | Fast | [OK] Good |