A boundary check loses one character

A suite can execute every line of a module and still pass after one of that module's boundary checks is quietly tightened. Mutation testing starts from that gap. PIT applies configurable mutation operators to compiled bytecode: CONDITIONALS_BOUNDARY_MUTATOR turns a >= into a >, while other operators delete method calls, invert logic or change return values. Each change produces a mutant, and the existing suite is run against it. A failing test kills the mutant; a fully green run leaves it surviving. The code under test was altered on purpose, so the resulting report describes what the tests detect.

Two conditions matter at the input end. PIT works on bytecode rather than source, so compiled artifacts need line-number and source-file debug information for results to map back to readable locations. The set of possible mutants is described by the project as potentially very large — a qualitative statement in the docs, not a measured count. A suite worth keeping is expected to fail while a mutant is present.

Line coverage and this kind of score answer different questions. Coverage records that a line ran. It says nothing about whether an assertion examined the value that line produced. A module can sit at full line coverage with a boundary check nobody challenges, and a single injected change brings that fact to the surface.

Four rows that keep the numbers honest

ReportDefinition and denominatorWhat it does not establish
Killed / SurvivedPIT, per mutantWhether an assertion checked the value; only that the suite failed or stayed green
No coveragePIT lists it as its own outcome; Stryker folds it into undetectedWhy cross-tool totals are not comparable
detected / valid × 100Stryker, denominator is detected plus undetectedAny line coverage figure; invalid mutants are excluded
detected / covered × 100Stryker, denominator drops no-coverage mutantsThat it is the same quantity as the score above; these are two different metrics
Equivalent mutantBoth tools record it as survivedThat the suite is weak; no input separates the change from the original
Stubborn mutantSurvives a strong suiteThat it is equivalent; a distinguishing input exists

Two tools, two bookkeeping systems

PIT reports seven outcomes per mutation: Killed, Survived, No coverage, Non viable, Timed Out, Memory error and Run error. Survived means a test reached the line and still passed. No coverage means no test reached it at all. Timed Out often comes from an operator deleting a loop increment, leaving a loop that never ends. Keeping No coverage as its own bucket is a deliberate choice.

Stryker defines eight mutant states — Pending, Killed, Survived, No coverage, Timeout, Runtime error, Compile error and Ignored — and folds No coverage into undetected. Its arithmetic is explicit: detected equals killed plus timeout; undetected equals survived plus no coverage; covered equals detected plus survived; valid equals detected plus undetected; invalid consists of runtime and compile errors, which do not enter the score. The commonly quoted figure is detected divided by valid, times 100. A second, covered-based figure divides by covered instead. Any score needs the tool and the denominator attached; without them it is a bare number.

Stryker's own explanation reaches for bread and jam. Coverage reports that 80 percent of the slice is spread; mutation testing reports whether the spread is chocolate. The tool mutates only the project's own source to avoid false positives from third-party code, and the docs list JavaScript and TypeScript, C# and Scala as supported platforms. The stated count of more than 30 mutation types is the project's description of its own feature set, not an independent benchmark.

The cost arrives once per mutant

The bill is a rerun for every mutant. Stryker's frequently asked questions open with the question of why the tool is slow, then suggest faster unit tests — browser suites should load fewer files — mutating only the code that matters, excluding test files and dependencies, and building a RAM disk. That last suggestion carries an explicit disclaimer in the docs: the maintainers say they have not tested it themselves. PIT takes a different angle, using line coverage analysis and test timings to choose which tests to rerun, and describes itself as considerably faster than earlier systems such as Jester and Jumble. That speed claim is qualitative; no ratio is published. The practical consequence is a choice of scope: focus on critical business logic, or schedule the run as a nightly or weekly job rather than a per-commit gate.

The verdict in every one of these tools is a single signal: did a test fail? That fits unit tests and synchronous paths, where an assertion is a direct statement about a value. Timing, rendering and user interaction make the signal less reliable. A change in an animation or an event order may have no assertion attached, and a mutation run cannot manufacture one. Stryker's FAQ acknowledges that browser tests are slow; it publishes no detection rate for UI scenarios, so no such figure should be attached to it.

One 2014 count complicates the target

Equivalent mutants are the awkward case. One kind leaves behaviour identical — when a variable holds a particular value, a >= and a > comparison coincide. Another kind changes behaviour only outside the test's reach, typically in logging or debug code. PIT skips lines calling common logging frameworks by default, with a configurable list and a FLOGCALL switch to turn that behaviour off. An equivalent mutant cannot be killed by a better suite, because no input separates it from the original.

A stubborn mutant is different: a distinguishing input exists, but a strong suite has still missed it. Yao, Harman and Jia manually examined 1,230 mutants from 18 programs for ICSE 2014. They found the two categories distributed very unevenly across operator classes: ABS and half of UOI produced plenty of equivalent mutants and almost no stubborn ones, while LCR produced many stubborn mutants and few equivalent ones. Their inference was that effectiveness studies based on fault seeding may be skewed, and that tool builders should give priority to operators creating stubborn mutants. That is an experimental sample and an authorial inference, not a survey of production suites.

Both points argue against treating 100 percent as a goal. Equivalent mutants and logging code make a full score unreachable or meaningless, and chasing it rewards brittle tests written to kill one specific change. A more useful habit is to read surviving mutants as a ranked list of places where an assertion might be missing. Nothing in that research converts a score into a prediction of production defects: no supported quantitative relationship exists between the two.

Where a shared runtime changes the arithmetic

For a team shipping one capability to several hosts, mutation testing is most tractable on logic that lives in one place. A shared runtime gives the suite a single target: inject the changes once, rerun once, and carry the strengthened assertions into every host that embeds the capability. Contract tests constrain the boundary where a host supplies its own behaviour, because the messages crossing that boundary are where an injected change can be hardest to interpret. That is a mechanism for reusing verification work. The research reviewed here contains no mini-program-specific mutation score, and inventing one would repeat the mistake this article is about.

Sources