Skip to content
running-mutation-tests logo

Mutation Test Runner

running-mutation-tests

Execute mutation testing to evaluate test suite effectiveness.

SKILL.md

Full skill instructions

Mutation Test Runner

Overview

Execute mutation testing to evaluate the effectiveness of a test suite by systematically introducing small code changes (mutants) and checking whether existing tests detect them. A killed mutant means the tests caught the change; a surviving mutant reveals a testing gap.

Prerequisites

  • Mutation testing framework installed (Stryker, mutmut, PITest, or go-mutesting)
  • Existing test suite with reasonable pass rate (all tests must pass before mutation testing)
  • Source code with functions and logic suitable for mutation (conditionals, arithmetic, return values)
  • Sufficient CI resources (mutation testing runs the test suite once per mutant -- CPU-intensive)
  • Configuration file for the mutation tool specifying target files and test commands

Instructions

  1. Verify the existing test suite passes completely:
    • Run the full test suite and confirm 100% pass rate.
    • Fix any failing or skipped tests before proceeding.
    • Mutation testing is meaningless if the baseline tests are broken.
  2. Configure the mutation testing tool:
    • Stryker: Create stryker.config.mjs with mutate patterns, test runner, and thresholds.
    • mutmut: Configure setup.cfg or pyproject.toml with [mutmut] section.
    • PITest: Add Maven/​Gradle plugin with target classes and test configurations.
  3. Select target files for mutation:
    • Focus on business logic modules (not configuration, constants, or type definitions).
    • Exclude auto-generated code, third-party wrappers, and test utilities.
    • Start with a small scope (one module) to validate setup before expanding.
  4. Run the mutation testing suite:
    • Execute npx stryker run, mutmut run, or mvn pitest:mutationCoverage.
    • Monitor progress -- expect long execution times (10-100x normal test runtime).
    • Use incremental mode if available to skip already-tested mutants.
  5. Analyze the mutation report:
    • Killed mutants: Tests detected the change -- indicates strong test coverage.
    • Survived mutants: Tests did not catch the change -- indicates a testing gap.
    • Timed out mutants: Mutation caused an infinite loop -- generally acceptable.
    • No coverage mutants: The mutated code is not exercised by any test.
  6. For each surviving mutant, determine the appropriate action:
    • Write a new test that specifically catches the mutation.
    • Or determine the mutation is equivalent (functionally identical to original) and mark as ignored.
  7. Set mutation score thresholds (recommended: 80% kill rate) and integrate into CI as a quality gate.

Output

  • Mutation testing report (HTML or JSON) with killed/​survived/​timed-out counts
  • Mutation score percentage (killed / total non-equivalent mutants)
  • Surviving mutant inventory with file, line, mutation type, and suggested test
  • New test cases written to kill surviving mutants
  • CI configuration with mutation score threshold enforcement

Error Handling

ErrorCauseSolution
Mutation run takes hoursToo many files in scope or slow test suiteNarrow mutate scope to critical modules; use --incremental mode; parallelize with --concurrency
All mutants surviveTests only check for truthiness, not specific valuesStrengthen assertions -- use toBe(42) instead of toBeTruthy(); add boundary checks
Equivalent mutant false positiveMutation produces functionally identical code (e.g., x >= 0 vs x > -1)Mark as equivalent in config; ignore in score calculation; document rationale
Out of memory during runToo many concurrent mutation workersReduce --concurrency setting; increase Node.js --max-old-space-size; reduce shard size
Stryker "initial test run failed"Test suite does not pass cleanly before mutations beginFix all failing tests first; ensure npm test exits 0; check test runner configuration

Examples

Stryker configuration for TypeScript project:

// stryker.config.mjs
export default {
  mutate: ['src/​**/​*.ts', '!src/​**/​*.d.ts', '!src/​**/​index.ts'],
  testRunner: 'jest',
  jest: { configFile: 'jest.config.ts' },
  reporters: ['html', 'clear-text', 'progress'],
  thresholds: { high: 80, low: 60, break: 50 },
  concurrency: 4,
  timeoutMS: 10000,  # 10000: 10 seconds in ms
};

Example surviving mutant and fix:

Mutant: src/​utils/​discount.ts:15 -- ConditionalExpression
  Original:  if (total > 100)
  Mutant:    if (total >= 100)
  Status:    SURVIVED

Fix -- add boundary test:
it('does not apply discount at exactly 100', () => {
  expect(calculateDiscount(100)).toBe(0);
});
it('applies discount above 100', () => {
  expect(calculateDiscount(101)).toBe(10.1);
});

mutmut for Python:

# Run mutation testing
mutmut run --paths-to-mutate=src/ --tests-dir=tests/

# View surviving mutants
mutmut results

# Inspect a specific mutant
mutmut show 42

Resources

More skills from jeremylongshore

openrouter-compliance-review logo
jeremylongshore/claude-code-plugins-plus-skills

openrouter-compliance-review

Review OpenRouter integration for regulatory compliance (SOC2, GDPR,

2.8K 0
View
maintainx-data-handling logo
jeremylongshore/claude-code-plugins-plus-skills

maintainx-data-handling

Data synchronization, ETL patterns, and data management for MaintainX.

2.8K 0
View
groq-core-workflow-a logo
jeremylongshore/claude-code-plugins-plus-skills

groq-core-workflow-a

Execute Groq primary workflow: chat completions with tool use and JSON

2.8K 0
View
validating-csrf-protection logo
jeremylongshore/claude-code-plugins-plus-skills

validating-csrf-protection

Validate CSRF protection implementations for security gaps. Use when

2.8K 0
View
api-contract logo
jeremylongshore/claude-code-plugins-plus-skills

api-contract

Configure this skill should be used when the user asks about "API contract",

2.8K 0
View
ideogram-incident-runbook logo
jeremylongshore/claude-code-plugins-plus-skills

ideogram-incident-runbook

Execute Ideogram incident response with triage, mitigation, and postmortem.

2.8K 0
View
gamma-sdk-patterns logo
jeremylongshore/claude-code-plugins-plus-skills

gamma-sdk-patterns

Reusable patterns for the Gamma REST API (no SDK exists).

2.8K 0
View
deepgram-sdk-patterns logo
jeremylongshore/claude-code-plugins-plus-skills

deepgram-sdk-patterns

Apply production-ready Deepgram SDK patterns for TypeScript and Python.

2.8K 0
View
openrouter-upgrade-migration logo
jeremylongshore/claude-code-plugins-plus-skills

openrouter-upgrade-migration

Migrate to OpenRouter from direct provider APIs or upgrade between SDK/model

2.8K 0
View
openrouter-common-errors logo
jeremylongshore/claude-code-plugins-plus-skills

openrouter-common-errors

Diagnose and fix common OpenRouter API errors. Use when encountering

2.8K 0
View
linear-cost-tuning logo
jeremylongshore/claude-code-plugins-plus-skills

linear-cost-tuning

Optimize Linear API usage, reduce unnecessary calls, and maximize

2.8K 0
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View