Skip to content
mutastic

Java edition

mutastic mutants

List the mutants, without running a test. One line each: its id, place, operator, the change, and the method it's in; the last line counts them. The build compiles the code, as the mutants are in its classes, and no test runs. With --operators, it shows what those would add before a run, and the line before the count estimates what they add to the tests' time, by the last run's record; --estimate runs every test once to measure them first.

Usage

Terminal window
mutastic mutants [DIR] [:MODULE]

A coding agent's hooks run it as the command: the build plugins don't.

Output

This is mutastic's own output, written from the CLI and checked against it on every build.

Terminal window
m855c8e3c src/main/java/com/example/pricing/Pricing.java:17:15 mutastic/boundary >= becomes > in Pricing.discount()
m53e1dc80 src/main/java/com/example/pricing/Pricing.java:17:15 mutastic/remove-conditional total >= 100 is always false in Pricing.discount()
mfb551430 src/main/java/com/example/pricing/Pricing.java:17:15 mutastic/remove-conditional total >= 100 is always true in Pricing.discount()
mf7bb3882 src/main/java/com/example/pricing/Pricing.java:18:7 mutastic/return-value returns 0 instead in Pricing.discount()
mabd5e44c src/main/java/com/example/pricing/Pricing.java:18:20 mutastic/math / becomes * in Pricing.discount()
m3264f639 src/main/java/com/example/pricing/Pricing.java:20:5 mutastic/return-value returns 1 instead in Pricing.discount()
m2de3396d src/main/java/com/example/pricing/Pricing.java:25:15 mutastic/boundary < becomes <= in Pricing.shipping()
m73f3386e src/main/java/com/example/pricing/Pricing.java:25:15 mutastic/remove-conditional total < freeShippingFrom is always false in Pricing.shipping()
m091729b1 src/main/java/com/example/pricing/Pricing.java:25:15 mutastic/remove-conditional total < freeShippingFrom is always true in Pricing.shipping()
m39e3e756 src/main/java/com/example/pricing/Pricing.java:26:7 mutastic/return-value returns 0 instead in Pricing.shipping()
m3b5420b6 src/main/java/com/example/pricing/Pricing.java:28:5 mutastic/return-value returns 1 instead in Pricing.shipping()
11 mutants

Exit status

0 once they're listed. Any command exits 2 for a usage error or a build it couldn't read, and 4 when mutastic itself went wrong; one that runs tests, 3 when they fail without any mutant: see exit codes.

Options

--at=PATH:LINE

Run, or list, only the mutants on a line of a source file, or with :FROM-TO on those lines, under the run's operators; several split by commas. The run passes when each is caught or skipped.

Gradle-Pmutastic.at=PATH:LINE,…
Maven-Dmutastic.at=PATH:LINE,…
Command line--at=PATH:LINE

--operators=OPERATORS

Which operators run: a set (defaults, stronger, extended or all), an operator's id or namespace, or any with - in front to leave it out; defaults unless set.

Gradle-Pmutastic.operators=OPERATORS,…
Maven-Dmutastic.operators=OPERATORS,…
Command line--operators=OPERATORS

--estimate

Run every test once, with no mutant in, and estimate what defaults, stronger and all would take.

Command line--estimate