mutation-testing

Configure and run PIT mutation testing on Gradle projects and interpret mutation scores.

Updated May 4, 2026
One-click install
npx skills add https://github.com/studenkov/FinanceTracker --skill mutation-testing-studenkov
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: mutation-testing
Source: https://github.com/studenkov/FinanceTracker/tree/main/.agents/skills/mutation-testing
Command: npx skills add https://github.com/studenkov/FinanceTracker --skill mutation-testing-studenkov

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve? Line coverage metrics like JaCoCo can hide tests that assert nothing. This Skill sets up PIT (pitest) mutation testing in a Gradle build, runs it, and reads the mutation score so you can measure whether your tests actually catch bugs rather than just execute code. ## Core Features & Use Cases - Build Configuration: Adds the PIT Gradle plugin with correctly resolved plugin, PIT, and JUnit 5 bridge versions, including the three environment fixes required for JUnit Platform 6 (Spring Boot 4) projects. - Exclusion Management: Helps decide what to exclude from mutation analysis (bean wiring, generated code, accessors) via a structured questionnaire, applying the narrowest mechanism such as excludedClasses, excludedMethods, or a @DoNotMutate annotation. - Score Reporting: Runs PIT and summarizes mutations.xml into mutation score, test strength, per-class breakdown, and actionable survived/no-coverage mutants with file and line numbers. - Use Case: A Spring Boot 4 project shows 90% JaCoCo coverage but tests assert little. Use this Skill to configure PIT, exclude noise like getters and MapStruct mappers, run the analysis, and get a list of surviving mutants pointing to missing assertions. ## Quick Start Set up PIT mutation testing in my Gradle project, run it, and tell me the mutation score with the surviving mutants.

Frequently Asked Questions about mutation-testing

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

FAQPage Schema
How do I set up PIT mutation testing in a Gradle project?

Add the info.solidsoft.pitest plugin from the Gradle Plugin Portal and a pitest {} block pinning pitestVersion and junit5PluginVersion explicitly. Set targetClasses, testSourceSets, and keep XML output enabled so the results can be summarized.

How do I run mutation testing with PIT and read the score?

Run ./gradlew pitest, then parse build/reports/pitest/mutations.xml. The score counts mutants by the detected attribute, not status names, so TIMED_OUT and RUN_ERROR are not misclassified; report both mutation score and test strength.

Does PIT work with JUnit Platform 6 and Spring Boot 4?

Yes, the pitest-junit5-plugin bridge works with Platform 6, but the run needs three fixes: point jvmPath at the toolchain JDK, add JUnit 6 launcher and engine to the pitest configuration, and use dependencySubstitution to align junit-platform-launcher.

Why does my PIT run report every class as NO_COVERAGE?

This usually means the PIT minion JVM inherited the Gradle daemon's older JDK and cannot load newer class files, so it discovers zero tests. Set jvmPath to the toolchain's java executable inside the pitest {} block.

What should I exclude from mutation testing analysis?

Exclude code with no behavior worth asserting: bean wiring, generated code like MapStruct mappers, and accessors or Object boilerplate via excludedMethods. Keep anything with a branch, computation, or decision, even if currently untested, so missing tests stay visible.

Why is mutation testing better than JaCoCo line coverage?

Line coverage only shows code was executed, not that tests assert on results. Mutation testing injects small faults and checks whether tests kill them, exposing tests that run code but verify nothing.