Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 20 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,19 @@ script on a one-class build with both Gradle 8.14.3 and its tests on JDK 11.
```

3. Tell the agents that work on the project. `./gradlew -q cribro` prints the guide for the version the build runs, so
a note in `AGENTS.md`, or in whichever file the project's agents read, needs only to name that command:
a note in `AGENTS.md`, or in whichever file the project's agents read, names the commands and the two markers and
leaves the rest to the guide:

```markdown
After changing the Java or Kotlin sources under `src/main` of a module, run `./gradlew <project>:test`, where
`<project>` is that module's Gradle project path, such as `:app`, and act on the diff coverage report it
prints. `./gradlew -q cribro` prints how to read the reports and how to run mutation testing.
`<project>` is that module's Gradle project path, such as `:app`, and act on the diff coverage report it prints.
Once the changed lines are covered, run `./gradlew <project>:pitestDiff -Pcribro.pitestTargetTests=<test classes>`
and act on the mutants it reports; `test` does not run it.
Mark an uncovered line that is unreachable or not worth a test with `// diff-coverage: ignore -- <reason>`, and a
mutant no caller can observe with `// mutant: equivalent <id> -- <reason>`, where `<id>` is the text in brackets
after the mutant in the `pitestDiff` report, such as `MathMutator#2`.
Before your first measurement in a task, run `./gradlew -q cribro`: it prints how to read both reports and how to
write the markers.
```

To upgrade, change the version in `settings.gradle(.kts)`.
Expand Down Expand Up @@ -299,13 +306,21 @@ Tried on Guava, whose tests live in `guava-tests` and test the code of `guava`,
```

3. Tell the agents that work on the project. `mvn -q cribro:guide` prints the guide for the version the build loads,
so a note in `AGENTS.md`, or in whichever file the project's agents read, needs only to name it:
so a note in `AGENTS.md`, or in whichever file the project's agents read, names the commands and the two markers and
leaves the rest to the guide:

```markdown
After changing the Java or Kotlin sources under `src/main` of a module, run `mvn -pl <module> -am test`, where
`<module>` is the module whose tests exercise the change, such as `:app`, and act on the diff coverage report it
prints.
`mvn -q cribro:guide` prints how to read the reports and how to run mutation testing.
Once the changed lines are covered, run
`mvn -pl <module> -am test-compile cribro:pitest-diff -Dcribro.pitestTargetTests=<test classes>` and act on the
mutants it reports; `test` does not run it.
Mark an uncovered line that is unreachable or not worth a test with `// diff-coverage: ignore -- <reason>`, and a
mutant no caller can observe with `// mutant: equivalent <id> -- <reason>`, where `<id>` is the text in brackets
after the mutant in the `cribro:pitest-diff` report, such as `MathMutator#2`.
Before your first measurement in a task, run `mvn -q cribro:guide`: it prints how to read both reports and how to
write the markers.
```

To upgrade, change the version in `.mvn/extensions.xml`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,24 +85,18 @@ survives marks a changed line whose behavior no test asserts. For each live muta

The report ends each mutant with its id in brackets, such as `[RemoveConditionalMutator_EQUAL_ELSE#2]`: the PIT mutator,
with a number where the mutator made more than one mutant on the line. The number counts them by method and, within a
method, in bytecode order, so on `a || b` the mutant of `a` comes first. Record an equivalent mutant on its line with
`// mutant: equivalent <id> -- <why no caller can observe it>`, where `<id>` is the text in the brackets, or with
`/* ... */` where the line goes on after it; several ids are separated by commas. Put the marker last on its line: the
reason of a `//` marker runs to the end of the line, so a `// diff-coverage: ignore` after it becomes part of the
reason. The marker counts where it starts a comment or sits anywhere later in a line comment, even where that text only
quotes the syntax; one inside a string literal or in the text of a block comment, such as a Javadoc paragraph, does not
count. The mutant leaves the list of live mutants and stays in the counts, the line with the counts ends with how many
live mutants are acknowledged, such as `; 1 of the live ones acknowledged as equivalent`, and the report lists the
mutant under `Live mutants acknowledged as equivalent` with the reason every time the line is changed again;
`survivors.txt` holds the whole list when the console cuts it. The number depends on the other mutants the same mutator
makes on the line, so when the line changes, check that each acknowledged id still names the mutant its reason is about.

A marker is read only on a changed line. A marker that does not parse, or that has an id naming no mutant of its line or
a mutant that is not live (the tests killed it, or PIT gave it another status, such as `NON_VIABLE`), is listed under
`Markers to correct` with its line as written, followed by every id the line has and its status. Where an id names a
mutant that is not live, or no mutant, the code or the tests have likely changed since the verdict, so judge the line
again. A marker that names a mutator of a stronger group, such as `RemoveConditionalMutator_*`, names nothing in a run
with `DEFAULTS`: keep it, and check it in a run with the group it was written for.
method, in bytecode order, so on `a || b` the mutant of `a` comes first.

Record an equivalent mutant on its line with `// mutant: equivalent <id> -- <why no caller can observe it>`, where
`<id>` is the text in the brackets; separate several ids with commas. A `//` marker takes the rest of the line as its
reason, so where the line goes on after the marker, write it as `/* mutant: equivalent <id> -- <reason> */`, and on a
line that also carries `// diff-coverage: ignore -- <reason>`, put the mutant marker after it. The mutant then leaves
the list of live mutants, stays in the counts, and is listed with its reason under `Live mutants acknowledged as
equivalent` each time the line changes again.

The number in an id depends on the other mutants the same mutator makes on the line, so when you change a line that
carries a marker, check that each id still names the mutant its reason is about. A marker the run cannot match is listed
under `Markers to correct:` with every id of its line, each with its status, followed by what to do with it.

The report opens with the number of mutants and of the changed lines with bytecode that carry one, such as `8 mutants
on 7 of 24 changed lines`. Mutation testing checks nothing on the other changed lines, whatever their coverage. A
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,24 +90,18 @@ survives marks a changed line whose behavior no test asserts. For each live muta

The report ends each mutant with its id in brackets, such as `[RemoveConditionalMutator_EQUAL_ELSE#2]`: the PIT mutator,
with a number where the mutator made more than one mutant on the line. The number counts them by method and, within a
method, in bytecode order, so on `a || b` the mutant of `a` comes first. Record an equivalent mutant on its line with
`// mutant: equivalent <id> -- <why no caller can observe it>`, where `<id>` is the text in the brackets, or with
`/* ... */` where the line goes on after it; several ids are separated by commas. Put the marker last on its line: the
reason of a `//` marker runs to the end of the line, so a `// diff-coverage: ignore` after it becomes part of the
reason. The marker counts where it starts a comment or sits anywhere later in a line comment, even where that text only
quotes the syntax; one inside a string literal or in the text of a block comment, such as a Javadoc paragraph, does not
count. The mutant leaves the list of live mutants and stays in the counts, the line with the counts ends with how many
live mutants are acknowledged, such as `; 1 of the live ones acknowledged as equivalent`, and the report lists the
mutant under `Live mutants acknowledged as equivalent` with the reason every time the line is changed again;
`survivors.txt` holds the whole list when the console cuts it. The number depends on the other mutants the same mutator
makes on the line, so when the line changes, check that each acknowledged id still names the mutant its reason is about.

A marker is read only on a changed line. A marker that does not parse, or that has an id naming no mutant of its line or
a mutant that is not live (the tests killed it, or PIT gave it another status, such as `NON_VIABLE`), is listed under
`Markers to correct` with its line as written, followed by every id the line has and its status. Where an id names a
mutant that is not live, or no mutant, the code or the tests have likely changed since the verdict, so judge the line
again. A marker that names a mutator of a stronger group, such as `RemoveConditionalMutator_*`, names nothing in a run
with `DEFAULTS`: keep it, and check it in a run with the group it was written for.
method, in bytecode order, so on `a || b` the mutant of `a` comes first.

Record an equivalent mutant on its line with `// mutant: equivalent <id> -- <why no caller can observe it>`, where
`<id>` is the text in the brackets; separate several ids with commas. A `//` marker takes the rest of the line as its
reason, so where the line goes on after the marker, write it as `/* mutant: equivalent <id> -- <reason> */`, and on a
line that also carries `// diff-coverage: ignore -- <reason>`, put the mutant marker after it. The mutant then leaves
the list of live mutants, stays in the counts, and is listed with its reason under `Live mutants acknowledged as
equivalent` each time the line changes again.

The number in an id depends on the other mutants the same mutator makes on the line, so when you change a line that
carries a marker, check that each id still names the mutant its reason is about. A marker the run cannot match is listed
under `Markers to correct:` with every id of its line, each with its status, followed by what to do with it.

The report opens with the number of mutants and of the changed lines with bytecode that carry one, such as `8 mutants
on 7 of 24 changed lines`. Mutation testing checks nothing on the other changed lines, whatever their coverage. A
Expand Down
Loading