spring-boot-testing
Originally frommarcelorodrigo/agent-skills
Installation
SKILL.md
Spring Boot Testing
This skill provides expert guidance for testing Spring Boot applications with modern patterns and best practices. Examples target Spring Boot 4; see the compatibility note below for Boot 3.
Compatibility: detect first
Read the project's Spring Boot version and test dependencies before writing tests, and do not upgrade them implicitly.
| Spring Boot 3.x | Spring Boot 4.x | |
|---|---|---|
| JUnit | 5 (Jupiter) | 6 by default (same org.junit.jupiter.api annotations; JUnit 5 tests keep working) |
| Mock beans | @MockitoBean / @MockitoSpyBean from 3.4 (Spring Framework 6.2); @MockBean / @SpyBean are deprecated |
@MockitoBean replaces @MockBean (do not use the old ones) |
| Test starters | spring-boot-starter-test covers everything |
modular: add spring-boot-starter-webmvc-test, spring-boot-starter-data-jpa-test, ... |
| Slice imports | org.springframework.boot.test.autoconfigure... |
moved, e.g. org.springframework.boot.webmvc.test.autoconfigure.WebMvcTest |
| Testcontainers | 1.x names | 2.x names (testcontainers-postgresql) |
Details: references/sb4-migration.md, references/mockitobean.md.