mcpField
S
spring-mvc-testing

spring-mvc-testing

github.com/spring-ai-communityTesting & quality5244 installsUpdated 27w ago
Repository

About spring-mvc-testing

A testing skill for developers working with Spring MVC. It covers MockMvc request and response checks, validation, and exception handling, while clarifying which testing tasks belong elsewhere.

Key features

  1. 01Configure @WebMvcTest and MockMvc
  2. 02Test common REST requests
  3. 03Assert responses with jsonPath
  4. 04Test validation and exception handlers
  5. 05Cover Boot 4 RestTestClient migration

Use cases

  1. 01Verify controller GET, POST, PUT, and DELETE requests
  2. 02Check response bodies and HTTP headers
  3. 03Test bean validation and controller exception handling

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/spring-ai-community/spring-testing-skills --skill spring-mvc-testing

After installing, type/spring-mvc-testingin Claude Code to confirm it loaded.

Bundled filesreferences/mvc-rest-testing-patterns.md

Details

From the project README

Spring MVC Testing

Signals: @WebMvcTest, MockMvc, jsonPath, @AutoConfigureMockMvc, @RestController, MockMvcRequestBuilders, MockMvcResultMatchers, objectMapper

Tested With

  • Spring Boot 3.2+ / Spring Boot 4.x
  • Spring Framework 6.x / Spring Framework 7.x
  • Spring Security 6.x / 7.x (auto-configured in @WebMvcTest)
  • JUnit 5

Do NOT Use This Skill When

  • Testing authentication, authorization, CSRF, JWT, or OAuth2 specifically → use spring-security-testing
  • Testing reactive endpoints (WebFlux, WebClient, SSE) → use spring-webflux-testing
  • Testing JPA repositories or database persistence → use spring-jpa-testing
  • Testing WebSocket or STOMP messaging → use spring-websocket-testing
  • Writing pure unit tests without a Spring context → use spring-testing-fundamentals

When to Read References

SituationRead
Setting up @WebMvcTest, MockMvc configuration, static importsreferences/mvc-rest-testing-patterns.md
GET, POST, PUT, DELETE request patternsreferences/mvc-rest-testing-patterns.md
jsonPath assertions, response headers, multipart uploadsreferences/mvc-rest-testing-patterns.md
Testing @Valid bean validation, @RestControllerAdvice exception handlersreferences/mvc-rest-testing-patterns.md
Boot 4 RestTestClient migrationreferences/mvc-rest-testing-patterns.md
Anti-patterns and common mistakesreferences/mvc-rest-testing-patterns.md

Comments

Markdown supported