Skip to content
affaan-m avatar

Springboot Tdd

Test-driven workflow for Spring Boot services using JUnit 5, Mockito, MockMvc, Testcontainers, and JaCoCo.

CCM score
71 of 100
skills.sh installs
13.4K
GitHub stars
312.6K
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers the write-fail-implement-refactor cycle plus unit, web-layer, integration, and persistence test slices
  • Includes code patterns for MockitoExtension, @WebMvcTest, @SpringBootTest, and @DataJpaTest with AssertJ assertions
  • Provides a JaCoCo Maven snippet and CI commands (mvn verify, ./gradlew test jacocoTestReport) to enforce 80%+ coverage
  • Designed for adding features, fixing bugs, or refactoring Spring Boot services with reusable Postgres and Redis containers

Install

$ npx -y skills add affaan-m/ecc --skill springboot-tdd -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

Spring Boot TDD Workflow

TDD guidance for Spring Boot services with 80%+ coverage (unit + integration).

When to Use

  • New features or endpoints
  • Bug fixes or refactors
  • Adding data access logic or security rules

Workflow

  1. Write tests first (they should fail)
  2. Implement minimal code to pass
  3. Refactor with tests green
  4. Enforce coverage (JaCoCo)

Unit Tests (JUnit 5 + Mockito)

@ExtendWith(MockitoExtension.class)
class MarketServiceTest {
  @Mock MarketRepository repo;
  @InjectMocks MarketService service;

  @Test
  void createsMarket() {
    CreateMarketRequest req = new CreateMarketRequest("name", "desc", Instant.now(), List.of("cat"));
    when(repo.save(any())).thenAnswer(inv -> inv.getArgument(0));

    Market result = service.create(req);

    assertThat(result.name()).isEqualTo("name");
    verify(repo).save(any());
  }
}

Patterns:

  • Arrange-Act-Assert
  • Avoid partial mocks; prefer explicit stubbing
  • Use @ParameterizedTest for variants

Web Layer Tests (MockMvc)

@WebMvcTest(MarketController.class)
class MarketControllerTest {
  @Autowired MockMvc mockMvc;
  @MockBean MarketService marketService;

Details

Repository
github.com/affaan-m/ecc
Categories
Testing & QA, Java & JVM
First seen
Jul 14, 2026

Questions

What is the springboot-tdd skill for?

The springboot-tdd skill guides test-driven development for Spring Boot services, with a target of 80% or more coverage across unit and integration tests. It covers building new features and endpoints, fixing bugs, and refactoring code in Spring Boot projects.

Which testing tools does the springboot-tdd skill use?

The skill's examples use JUnit 5 with Mockito for unit tests, MockMvc for web layer tests, SpringBootTest and DataJpaTest for integration and persistence tests, Testcontainers for Postgres and Redis, and JaCoCo for coverage. Maven or Gradle runs the test and coverage commands.

How do I install the springboot-tdd skill?

Run npx -y skills add affaan-m/ecc --skill springboot-tdd -y in your project to install it. Once installed, the skill gives the agent a test-first workflow: write failing tests, implement minimal code, refactor with tests green, and enforce JaCoCo coverage.

Where does springboot-tdd rank in its category?

The skill sits in the Testing and QA category on Claude Marketplaces and ranks in the top 50 there. Its category neighbors include tdd and test-driven-development, and this one is specific to Spring Boot projects.

More from affaan-m/ecc

All 257

Similar to Springboot Tdd

More Testing & QA