mutation-testing

Use PIT mutation testing to identify tests that pass but don't verify behavior correctly.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "mutation-testing" with this command: npx skills add bitsoex/bitso-java/bitsoex-bitso-java-mutation-testing

Mutation Testing

Use PIT mutation testing to identify tests that pass but don't verify behavior correctly.

When to use this skill

  • Improving test quality beyond line coverage metrics

  • Finding weak test assertions that don't catch bugs

  • Validating critical business logic has strong tests

  • Setting up mutation testing in CI pipelines

  • Analyzing which tests need strengthening

  • When asked to "improve test quality with mutation testing"

Skill Contents

Sections

  • When to use this skill

  • Quick Start

  • Key Concepts

  • References

  • Related Rules

  • Related Skills

Available Resources

📚 references/ - Detailed documentation

  • configuration

  • improving tests

  • intensity levels

  • troubleshooting

Quick Start

  1. Check readiness

bash java/scripts/check-pitest-readiness.sh

  1. Apply PIT configuration

Copy java/templates/pitest.gradle to gradle/pitest.gradle and apply in build.gradle .

  1. Run mutation testing

QUICK level - fast feedback

./gradlew pitest -Ppitest.mutators=DEFAULTS

STANDARD level - recommended

./gradlew pitest -Ppitest.mutators=STRONGER

COMPREHENSIVE level - thorough

./gradlew pitest -Ppitest.mutators=ALL

  1. Analyze results

open build/reports/pitest/index.html

Focus on SURVIVED mutants - these indicate weak tests.

  1. Improve tests

Add specific assertions that kill the surviving mutants.

Key Concepts

Mutation Score vs Line Coverage

  • Line coverage: Does your test execute the code?

  • Mutation score: Does your test actually verify the code works correctly?

High line coverage with low mutation score = tests run code but don't verify results.

Intensity Levels

Level Mutators Use Case Time

QUICK DEFAULTS (~11) Initial analysis, CI 1x

STANDARD STRONGER (~14) Regular improvement 1.5x

COMPREHENSIVE ALL (~30+) Critical logic 3-5x

Mutation Statuses

Status Meaning Action

Killed Test detected mutation Good

Survived Test missed mutation Improve test

No Coverage No test covers code Write test

Timed Out Infinite loop Usually OK

References

Reference Description

references/intensity-levels.md Detailed mutator descriptions

references/improving-tests.md Patterns for killing mutants

references/configuration.md PIT configuration options

references/troubleshooting.md Common issues and solutions

Related Rules

  • java-testing-guidelines - Spock/JUnit patterns

  • java-jacoco-coverage - Line coverage configuration

Related Skills

Skill Purpose

java-testing Test configuration

java-coverage JaCoCo coverage

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

gradle-standards

No summary provided by upstream source.

Repository SourceNeeds Review
General

java-coverage

No summary provided by upstream source.

Repository SourceNeeds Review
General

java-standards

No summary provided by upstream source.

Repository SourceNeeds Review