Project | Test quality
Mutation Testing with PIT
PIT mutates a small pricing module and checks which test suite notices; the strong suite shows the habits that kill mutants: both sides of every boundary, exact values, side effects. CI fails if one mutant survives.
Two suites with the same 100% line coverage: one kills all 81 mutants, the other only 42 (52%). The 39 survivors are bugs that would ship with every test green, such as an expired coupon that still gives its discount.
Evidence checked 14 Nov 2026 | Scheduled CI run on main
On this page
Problem and purpose
Line coverage says a line ran, not that a test would notice it being wrong. Mutation testing changes the code on purpose (>= to >, + to -, a call removed) and checks whether any test fails. The weak suite here is green and fully covered, yet an expired coupon could still give its discount.
Architecture
production code ──► PIT creates 81 mutants ──► runs the chosen suite against each
├─ a test fails ──► killed
└─ all tests pass ──► survived = a bug that could shipTechnology and tools
| Area | Tools |
|---|---|
| Code | Java 21: a small pricing module (cart, discounts, shipping, coupons, order pricing), money as whole cents |
| Tests | JUnit 6, AssertJ: a weak suite (15 tests) and a strong suite (40 tests) for the same classes |
| Measurement | PIT 1.30.2 with the STRONGER mutators, JaCoCo for line coverage |
| CI | GitHub Actions: both suites, the strong one fails below 100%, a summary of every surviving mutant; weekly scheduled run |
Engineering decisions and approach
- Same code, two suites: the difference is only in the tests, so the comparison is fair
- STRONGER instead of DEFAULTS: 18 more mutants, and 6 more weaknesses found in the weak suite
- No mocks: the real collaborators are wired, because a mock would hide the arithmetic PIT mutates
- Money as long cents, so PIT's math mutators can flip the operators
- The strong suite's gate is 100%: one surviving mutant fails CI
Test scope and execution approach
Project-specific checks and execution details documented in the repository:
- Table of the 39 surviving mutants, grouped by the bug that would ship and the test that kills it
- Boundary tables one unit apart: 99.99 and 100.00, 49.99 and 50.00, 1,000 g and 1,001 g
- Exact expected receipts, worked out by hand in comments
- Checks of side effects, such as a coupon really marked as used
- Test data builders, readable amounts and a fixture object
Results with dated evidence
Historical repository or workflow evidence
Scheduled CI run on main
Two suites with the same 100% line coverage: one kills all 81 mutants, the other only 42 (52%). The 39 survivors are bugs that would ship with every test green, such as an expired coupon that still gives its discount.
Evidence checked: | Open dated evidence
Evidence explorer
Static screenshots are labelled as images; dated workflow links identify the execution evidence and its check date.
Static material from the public repository. The linked verification record was checked 2026-11-14; that date is not a screenshot capture date.
Dated workflow record
Evidence checked 2026-11-14. Open Scheduled CI run on main
Local setup and execution
mvnw.cmd verify :: strong suite, fails below 100%
mvnw.cmd verify -Dsuite=weak -Dmutation.threshold=0 :: weak suite, report onlyWorkflow and reports
Known limitations
- A small module written for the project; real code bases score lower and take much longer to mutate
- Some mutants are equivalent (they cannot change behaviour); here none survived the strong suite
- Mutation testing measures the tests, not the requirements: a missing feature produces no mutant
- A small pricing module written for the project; mutation scores of real code bases are lower and take longer to compute.