本文へ移動
cccskills
無料GitHub で公開

pitest-mutation

Configures PIT (PITest) for mutation testing of JVM projects (Java, Kotlin via the Kotlin plugin) - wires the `pitest-maven` or `pitest-gradle-plugin` with `mutationThreshold`, `coverageThreshold`, target classes/tests filtering, runs `mvn pitest:mutationCoverage`, parses the HTML + XML reports. Use when the JVM suite needs mutation-quality verification - the canonical Java mutation testing tool, fast (PIT analyzes "in minutes rather than days").

日本語の概要は準備中です。原文の説明を表示しています。

testland/qaスター 13(GitHub 13 + cccskills 0)

実行スコア 未検証

インストール方法を見る

含まれるファイル(13)

  • SKILL.md6.7 KB
  • .tessl-plugin/plugin.json584 B
  • evals/hundred-percent-mandate-three-weeks-before-the-audit/criteria.json6.2 KB
  • evals/hundred-percent-mandate-three-weeks-before-the-audit/task.md14.7 KB
  • evals/kotlin-module-the-director-wants-at-java-parity/criteria.json5.9 KB
  • evals/kotlin-module-the-director-wants-at-java-parity/task.md11.5 KB
  • evals/mutation-gate-reports-zero-after-the-junit5-migration/criteria.json6.1 KB
  • evals/mutation-gate-reports-zero-after-the-junit5-migration/task.md11.8 KB
  • evals/three-hour-pr-job-the-team-has-stopped-waiting-for/criteria.json5.6 KB
  • evals/three-hour-pr-job-the-team-has-stopped-waiting-for/task.md8.9 KB
  • evals/two-build-files-two-scores-before-the-release-tag/criteria.json6.3 KB
  • evals/two-build-files-two-scores-before-the-release-tag/task.md11.7 KB
  • references/pitest-pitfalls.md1.4 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

pitest-mutation

Overview

Per pit-home:

"PIT is a mutation testing system for Java and JVM applications. It automatically introduces faults into code, then runs tests to see if they catch these modifications."

"Faults (or mutations) are automatically seeded into your code, then your tests are run. If your tests fail then the mutation is killed, if your tests pass then the mutation lived." (pit-home)

Per pit-home, PIT differentiates on speed: "analyzes in minutes rather than days" vs older mutation tools.

When to use

  • A JVM project (Java, Kotlin via plugin) needs mutation-quality verification.
  • A team wants to identify "partial testing that traditional metrics miss" (pit-home).
  • Maven / Gradle integration is required (PIT is first-class for both).

How to use

  1. Add the pitest-maven (or info.solidsoft.pitest Gradle) plugin, including pitest-junit5-plugin for JUnit 5 suites.
  2. Point targetClasses at production packages and targetTests at the matching test packages - never mutate test code.
  3. Set mutationThreshold and coverageThreshold to the current baseline and request HTML + XML outputFormats.
  4. Run mvn pitest:mutationCoverage (or ./gradlew pitest) and open target/pit-reports/<timestamp>/index.html.
  5. For each surviving mutant, add or strengthen a test until it is killed.
  6. Use -DwithHistory for PR runs so only changed code is re-mutated.
  7. In CI, run full weekly and incremental per-PR, uploading target/pit-reports/ as an artifact.

Step 1 - Install (Maven)

<plugin>
  <groupId>org.pitest</groupId>
  <artifactId>pitest-maven</artifactId>
  <version>1.17.0</version>
  <configuration>
    <targetClasses>
      <param>com.example.checkout.*</param>
    </targetClasses>
    <targetTests>
      <param>com.example.checkout.*Test</param>
    </targetTests>
    <mutationThreshold>75</mutationThreshold>
    <coverageThreshold>80</coverageThreshold>
    <outputFormats>
      <format>HTML</format>
      <format>XML</format>
    </outputFormats>
  </configuration>
  <dependencies>
    <dependency>
      <groupId>org.pitest</groupId>
      <artifactId>pitest-junit5-plugin</artifactId>
      <version>1.2.1</version>
    </dependency>
  </dependencies>
</plugin>

For JUnit 5, the pitest-junit5-plugin is required; for JUnit 4 the default plugin works.

Step 2 - Run

mvn pitest:mutationCoverage

Reports land at target/pit-reports/<timestamp>/. The index.html shows per-class mutation coverage.

Step 3 - Configure (Gradle)

plugins {
    id 'java'
    id 'info.solidsoft.pitest' version '1.15.0'
}

pitest {
    targetClasses = ['com.example.checkout.*']
    targetTests = ['com.example.checkout.*Test']
    mutationThreshold = 75
    coverageThreshold = 80
    outputFormats = ['HTML', 'XML']
    junit5PluginVersion = '1.2.1'
}

// Run via:
// ./gradlew pitest

Step 4 - Mutators

PIT's default mutator set covers conditional, arithmetic, return value, void method calls, and constructor calls. Activate additional mutator sets via <mutators>:

<mutators>
  <mutator>STRONGER</mutator>     <!-- All default + extra -->
  <mutator>DEFAULTS</mutator>     <!-- Default set -->
  <mutator>ALL</mutator>          <!-- Everything -->
</mutators>

Per pit-home, reports "combine line coverage with mutation coverage data."

Step 5 - pitmp-maven-plugin for incremental runs

For PRs, only mutate changed code:

mvn pitest:mutationCoverage -DwithHistory

withHistory reads / writes a history file in target/; subsequent runs only mutate code different from the cached history. For PR runs, combine with git diff to scope further:

mvn pitest:mutationCoverage \
  -Dfeatures='+gitci(level[1])' \
  -Dpitmp.git.diff.target=origin/main

(The pitmp-maven-plugin extension adds git-diff-based scoping; not in core PIT.)

Step 6 - CI integration

- uses: actions/setup-java@v4
  with: { distribution: temurin, java-version: '21' }

- name: Mutation testing (full)
  if: github.event_name == 'schedule'  # weekly cron
  run: mvn pitest:mutationCoverage

- name: Mutation testing (incremental, PR)
  if: github.event_name == 'pull_request'
  run: mvn pitest:mutationCoverage -DwithHistory

- uses: actions/upload-artifact@v4
  if: always()
  with:
    name: pit-reports
    path: target/pit-reports/

The XML output (mutations.xml) is machine-parseable for dashboards.

Step 7 - Kotlin support

PIT works with Kotlin via standard Maven/Gradle Kotlin plugins; mutators apply to compiled bytecode. Per pit-home, "ArcMutate, from the same team, extends PIT with Kotlin support, Spring integration, and Git analysis" - for richer Kotlin / Spring support, evaluate ArcMutate (commercial).

Worked example

CheckoutService in com.example.checkout has a free-shipping rule and green JUnit 5 tests.

  1. Wire the plugin (Step 1) with targetClasses = com.example.checkout.*, targetTests = com.example.checkout.*Test, mutationThreshold = 75.
  2. mvn pitest:mutationCoverage writes target/pit-reports/<timestamp>/index.html and fails the build below the 75 threshold.
  3. index.html flags a survivor: the free-shipping boundary total >= 50 mutated to total > 50, uncaught because no test uses total == 50.
  4. Add a JUnit 5 test at the total == 50 boundary; mvn pitest:mutationCoverage now kills the mutant and clears the threshold.
  5. Switch the PR job to -DwithHistory so later runs only re-mutate changed classes.

Pitfalls and limitations

Anti-patterns (mutating everything per PR, mutationThreshold: 100, mixed Maven/Gradle config, missing JUnit 5 plugin, targeting test classes, the ALL mutator set) and PIT's limitations (bytecode-level equivalent mutants, build-tool coupling, commercial Kotlin / Spring extras, per-class scope) are catalogued in references/pitest-pitfalls.md.

References

  • pit - PIT overview: mutation testing definition, JVM-only, speed claim ("minutes rather than days"), Maven/Gradle/Ant integration, ArcMutate Pro extension.
  • stryker-mutation, stryker-net-mutation, mutmut-mutation, mull-mutation - per-language siblings.

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

コメント

ログインなしで書き込めます。使ってみた感想、質問、動かなかった環境などを気軽にどうぞ。

まだコメントはありません。最初のコメントを書いてみませんか。

送信するとすぐに公開されます。メールアドレスや電話番号などの個人情報は書かないでください。URL は 2 つまでです。

0 / 1000 文字

このフォームは reCAPTCHA で保護されており、Google のプライバシーポリシーと利用規約が適用されます。

同じリポジトリのスキル

Builds a CI gate that fails the build on **new** WCAG / a11y violations introduced by a PR while grandfathering pre-existing violations on a per-rule / per-page baseline. Aggregates verdicts from axe-core / pa11y / Lighthouse a11y / WAVE / IBM Equal Access scans. Use when a project has accumulated a11y debt and a strict "zero violations" gate would block every PR - the ratchet pattern lets the team ship while preventing regressions.

日本語の概要は準備中です。原文の説明を表示しています。

testland/qa132026年10月20日 更新

Workflow skill that builds an A/B-test validity checklist from an experiment proposal, walking the canonical design-correctness gates - pre-registered OEC/power/guardrails, randomization unit + SRM check, assignment integrity, telemetry, peeking discipline, novelty/primacy, post-experiment SRM re-check - into a per-experiment checklist + sign-off form. Use when launching, auditing, or governing an experiment. For pitfall mechanics (guardrails, peeking) see experiment-results-interpreter's references; to read an already-valid result use experiment-results-interpreter; for per-SDK harness tests use experiment-sdk-testing - this gates DESIGN, not SDK code.

日本語の概要は準備中です。原文の説明を表示しています。

testland/qa132026年10月20日 更新

The single install-flow skill: the reference contract for the PWA install flow (installability gate fields, `beforeinstallprompt` handshake, per-platform paths - Android WebAPK / iOS Share menu / Firefox no-op - and the `display-mode` post-install signal, in references/install-flow-reference.md) plus the build-an-X workflow that emits the Add-to-Home-Screen suite. Walks the four-stage timeline, emitting one test per gate cell per [web.dev/articles/install-criteria][install-criteria], the deferred-prompt → `prompt()` → `userChoice` chain per [web.dev/articles/customize-install][customize-install], the iOS Safari manual-metadata branch (`apple-touch-icon`) per [web.dev/learn/pwa/installation][learn-pwa], and the post-install `(display-mode: standalone)` MQ assertion. Output: a Playwright spec with per-stage cells plus a coverage matrix. Use when a PWA's manifest, icons, or install handler change, when install conversion drops at an unknown stage, or when triaging a flaky install assertion.

日本語の概要は準備中です。原文の説明を表示しています。

testland/qa132026年10月20日 更新

Build-an-X workflow that uses an LLM to map existing tests to spec sections - given a spec doc + the test suite, the LLM identifies which tests cover which sections, surfaces uncovered sections (gap), and recommends specific tests to add. Output is a coverage matrix per spec ID. Scope is mapping tests that already exist and naming the gaps, not authoring tests for new acceptance criteria. Use when a spec doc and a test suite both exist but nobody can say which requirements are actually covered - before a release sign-off, an audit, or a decision about where to spend the next round of test effort.

日本語の概要は準備中です。原文の説明を表示しています。

testland/qa132026年10月20日 更新

Generates tests from natural-language specs (acceptance criteria, user stories, requirements) using an LLM, with confidence scoring per test case (LLM self-assessment plus heuristics: assertion quality, naming, completeness), batching uncertain cases for human review, and integration with the team's existing test framework. Use when the user asks to generate unit tests from acceptance criteria, convert user stories to test cases, automate test creation from requirements, or augment a spec-driven test suite with AI-generated stubs that are then curated before merge.

日本語の概要は準備中です。原文の説明を表示しています。

testland/qa132026年10月20日 更新

Configures Allure Report (test-runner adapter install, `allure-results` directory wiring, `categories.json` for failure classification, `history-trend.json` retention via the copy-history-between-runs pattern), runs the Allure CLI to convert `allure-results` to a static HTML site, and uploads the report as a CI artifact. Use when the team needs richer test reporting than JUnit XML - step-level attachments, per-test history, retry tracking, and severity / epic / feature labeling across framework-agnostic adapters (pytest, Jest, JUnit, TestNG, NUnit, Mocha). As a rich static HTML report generator, it is the open-source alternative to the sunset ExtentReports (JVM/.NET per-test HTML narrative); for hosted cross-run flakiness analytics rather than a static per-run report use currents-integration.

日本語の概要は準備中です。原文の説明を表示しています。

testland/qa132026年10月20日 更新

testland のスキルをすべて見る

このスキルの問題を報告する