github avatar

Spring Boot Testing

This is a comprehensive testing guide for Spring Boot 4 applications that cuts through the noise with a clear decision tree: use @WebMvcTest for controllers, @DataJpaTest for repositories, and plain JUnit for business logic. It emphasizes modern tools like MockMvcTester and RestTestClient over legacy alternatives, pairs everything with AssertJ for readable assertions, and includes practical references for each test slice. The best practices section is pragmatic, recommending 80% coverage with Jacoco and suggesting refactoring when a method needs more than 5-7 test cases. It's opinionated about the test pyramid and context caching, which is exactly what you want when learning a testing stack this deep.

skills.sh installs
2.1K
GitHub stars
41K
last updated
Aug 21, 2026

Install

$ npx -y skills add github/awesome-copilot --skill spring-boot-testing --agent claude-code

Installs into .claude/skills of the current project.

Files

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.xSpring Boot 4.x
JUnit5 (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 startersspring-boot-starter-test covers everythingmodular: add spring-boot-starter-webmvc-test, spring-boot-starter-data-jpa-test, ...
Slice importsorg.springframework.boot.test.autoconfigure...moved, e.g. org.springframework.boot.webmvc.test.autoconfigure.WebMvcTest
Testcontainers1.x names2.x names (testcontainers-postgresql)

Sponsors

Details

Repository
github.com/github/awesome-copilot
Categories
Testing & QA, Git & Pull Requests, AI & Agent Building, Java & JVM
First seen
Apr 16, 2026

More from github/awesome-copilot

All 318
1zernie avatartest-harnesszernie/vigilesInstall vigiles and test a Claude Code harness — hooks, skills, settings, CLAUDE.md — by picking the right tier (unit / deterministic / eval) and writing a test2.1Kskills.sh installs
2affaan-m avatarfsharp-testingaffaan-m/everything-claude-codefsharp testing1.6Kskills.sh installs
3affaan-m avatarquarkus-tddaffaan-m/everything-claude-codequarkus tdd1.6Kskills.sh installs
4forcedotcom avatargenerating-apex-testforcedotcom/afv-librarygenerating apex test1.6Kskills.sh installs
5jaganpro avatarsf-testingjaganpro/sf-skillssf testing1.4Kskills.sh installs
6lobehub avatartestinglobehub/lobe-chattesting1.3Kskills.sh installs