askill
spring-boot-testing

spring-boot-testingSafety 90Repository

Standards for unit, integration, and slice testing in Spring Boot 3

197 stars
3.9k downloads
Updated 2/2/2026

Package Files

Loading files...
SKILL.md

Spring Boot Testing Standards

Priority: P0

Implementation Guidelines

Test Strategy

  • Unit First: Prioritize pure unit tests (Mockito) over Context tests.
  • Slice Testing: Use @WebMvcTest (Controllers) and @DataJpaTest (Repos) to reduce build time.
  • Integration: Use @SpringBootTest only for critical end-to-end flows.

Best Practices

  • Real Infrastructure: Use Testcontainers for DB/Queues. Avoid H2/Embedded.
  • Assertions: Use AssertJ (assertThat) over JUnit assertions.
  • Isolation: Use @MockBean for downstream dependencies in Slice Tests.

Anti-Patterns

  • Context Reloading: **No Dirty Contexts**: Avoid @MockBean in base classes.
  • External Calls: **No network I/O**: Use WireMock.
  • System Out: **No System.out**: Use assertions.

References

Install

Download ZIP
Requires askill CLI v1.0+

AI Quality Score

92/100Analyzed 2/4/2026

Excellent technical reference for Spring Boot testing. It provides clear strategies, specific tool recommendations (Testcontainers, AssertJ), and identifies common anti-patterns. The inclusion of triggers and structured metadata makes it highly discoverable and actionable.

90
95
95
90
95

Metadata

Licenseunknown
Version-
Updated2/2/2026
PublisherHoangNguyen0403

Tags

ci-cdtesting