add-component-test-layer

Add componentTest source set, Gradle task wiring, and actuator health tests for Spring Boot 4.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/dprice-dev/claude-java-skills --skill add-component-test-layer
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: add-component-test-layer
Source: https://github.com/dprice-dev/claude-java-skills/tree/main/.claude/skills/add-component-test-layer
Command: npx skills add https://github.com/dprice-dev/claude-java-skills --skill add-component-test-layer

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It solves the problem of adding fast, slice-based verification for a Spring Boot 4 app without running full end-to-end servers, so controller wiring, actuator endpoints, and security-related behavior can be tested quickly and consistently.

Core Features & Use Cases

  • Component test source set: Adds a dedicated componentTest source set plus Gradle configuration inheritance from the testImplementation/testRuntimeOnly configurations.
  • Test task integration: Registers a componentTest Gradle task and wires it into tasks.check, including JaCoCo report/coverage verification ordering.
  • Actuator health coverage: Creates an ActuatorHealthTests class and ensures application.yml is configured to expose health endpoints with probe support.
  • Use Case: After implementing controller or actuator health changes, add @WebMvcTest/@SpringBootTest(MOCK) infrastructure and verify endpoints like /actuator/health, /liveness, and /readiness run as part of the component test tier.

Quick Start

Run the add-component-test-layer skill in your Spring Boot 4 repository to create the componentTest source set, configure the Gradle test task and JaCoCo, and generate ActuatorHealthTests plus the required actuator health configuration.

Frequently Asked Questions about add-component-test-layer

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add component tests to a Spring Boot 4 project without running a full server?

You can add fast component tests by creating a dedicated componentTest source set with Gradle and using @WebMvcTest or @SpringBootTest(MOCK) slice tests to verify controller wiring without starting a full end-to-end server.

How do I configure Gradle for a separate component test source set?

Configure Gradle by adding a componentTest source set that inherits from testImplementation and testRuntimeOnly, then register a componentTest task and wire it into tasks.check with JaCoCo coverage verification.

How do I test actuator health endpoints like liveness and readiness in Spring Boot?

Test actuator health endpoints by generating an ActuatorHealthTests class and configuring application.yml to expose health endpoints with probe support for verifying /actuator/health, /liveness, and /readiness responses.

Does the component test layer require an existing unit test layer?

Yes, the component test layer depends on the add-unit-test-layer skill, meaning you must have the foundational unit testing infrastructure established before adding component-level slice tests.

What is the difference between slice tests and full Spring Boot integration tests?

Slice tests like @WebMvcTest focus on specific application layers such as controller wiring and actuator endpoints for fast verification, whereas full integration tests start the entire server context for comprehensive end-to-end validation.

Can I use RestTestClient for WebMvcTest component tests in Spring Boot 4?

Yes, the component test infrastructure sets RestTestClient test dependencies specifically for WebMvcTest configurations, enabling you to perform fast slice-based controller verification in Spring Boot 4.