
Spring Boot Testing
This is a comprehensive testing guide for Spring Boot 4 that actually tells you which annotation to use when. It's built around the test pyramid and includes decision trees for choosing between @WebMvcTest, @DataJpaTest, @RestClientTest, and friends. The best part is the practical coverage: it shows you MockMvcTester (the new AssertJ-style API), Testcontainers for real database tests, and Instancio for generating test data. It also covers the Spring Boot 4 migration path from deprecated @MockBean to @MockitoBean. The complexity assessment section is refreshingly honest about when to refactor instead of writing 50 test cases for a god method. If you're moving to Spring Boot 4 or just tired of guessing which test slice to use, this gets you unstuck fast.
- skills.sh installs
- 215
- GitHub stars
- 19
- last updated
- Aug 21, 2026
Install
$ npx -y skills add marcelorodrigo/agent-skills --skill spring-boot-testing --agent claude-codeInstalls into .claude/skills of the current project.
Files
Spring Boot Testing
Expert guide for testing Spring Boot 4 applications with modern patterns and best practices.
Core Principles
- Test Pyramid: Unit (fast) > Slice (focused) > Integration (complete)
- Right Tool: Use the narrowest slice that gives you confidence
- AssertJ Style: Fluent, readable assertions over verbose matchers
- Modern APIs: Prefer MockMvcTester and RestTestClient over legacy alternatives
Which Test Slice?
| Scenario | Annotation | Reference |
|---|---|---|
| Controller + HTTP semantics | @WebMvcTest | references/webmvctest.md |
| Repository + JPA queries | @DataJpaTest | references/datajpatest.md |
| REST client + external APIs | @RestClientTest | references/restclienttest.md |
| JSON (de)serialization | @JsonTest | See references/test-slices-overview.md |
| Full application | @SpringBootTest | See references/test-slices-overview.md |
Test Slices Reference
Sponsors
Details
- Repository
- github.com/marcelorodrigo/agent-skills
- Categories
- Testing & QA, AI & Agent Building, Java & JVM
- First seen
- Jun 3, 2026