# Test suite minimization

Minimization is the [regression-suite management](https://quality.stereobooster.com/regression-management.md)
technique that permanently *removes* tests judged redundant against a criterion,
typically coverage. Where several tests cover the same statements, one is kept
and the rest are dropped (Yoo and Harman 2012)[^yoo2012].

## What it does

It caps suite growth by discarding coverage-redundant tests for good.

The danger is inherent in the criterion. Coverage redundancy is redundancy in the
reachability link of the [RIPR
chain](https://quality.stereobooster.com/measuring-test-effectiveness.md#why-a-test-catches-a-fault-the-ripr-chain)
alone; two tests that execute the same lines can still differ in whether they
*infect* and *propagate* state. A test that is redundant for coverage may be the
sole detector of a real fault, and deleting it optimizes reachability while
throwing that detector away.

## Choosing the criterion

The same coverage profile supports opposite decisions. When read as gaps it argues for *adding*
tests where code is unexercised; when read as redundancy it argues for *removing*
tests that exercise only already-covered code. Minimization is that second
reading of the same profile. The profile also marks what is *not* safe to drop: a
test that is the sole cover of some statement is not redundant on the criterion,
so a coverage-preserving minimizer must keep it. (Formally it is a set-cover
problem: the smallest subset of tests whose union still covers every element.)

[Mutation testing](https://quality.stereobooster.com/mutation-testing.md) supplies a criterion stronger than
coverage: it scores
each test by the mutants it kills, and counts a test redundant only when every
mutant it kills is also killed by another test. A kill exercises the whole RIPR
chain, so mutation-redundancy accounts for the infection and propagation that
coverage cannot see, and a test that uniquely kills a mutant is kept even where
its lines are covered elsewhere. It costs far more to compute, which is why
coverage stays the common criterion despite being the weaker one.

## When to use, when not

Prefer [selection](https://quality.stereobooster.com/regression-test-selection.md) (skip a test for this
run) over permanent minimization (delete it for good), unless the suite's growth
is genuinely unsustainable and the deleted tests are demonstrably redundant, not
just coverage-redundant.

**Don't minimize a suite to hit a size or coverage target.** Deleting
coverage-redundant tests to make a number move is Goodhart's-law gaming, the same
failure mode that afflicts [coverage targets](https://quality.stereobooster.com/coverage.md); it buys a
smaller suite at the risk of a lost fault detector.

## Classification

- **Quality dimensions:** Maintainability (caps suite growth by permanently removing coverage-redundant tests) — permanently removes coverage-redundant tests; it prunes the suite, it does not run or verify it, so it sits off the code-verification axes.
- **Area:** Suites whose growth is genuinely unsustainable and whose redundant tests are demonstrably safe to delete.

## Referenced by

- [Mutation testing](https://quality.stereobooster.com/mutation-testing.md) · Methods
- [Regression-suite management](https://quality.stereobooster.com/regression-management.md) · Methods
- [The test suite as an object](https://quality.stereobooster.com/test-suite.md) · Methods

## References

[^yoo2012]: Yoo, Shin, and Mark Harman. 2012. "[Regression Testing Minimization, Selection and Prioritization: A Survey](https://coinse.github.io/publications/pdfs/Yoo2010fk.pdf)." *Software Testing, Verification and Reliability* 22 (2): 67–120. <https://doi.org/10.1002/stvr.430>.

## Acronyms

- RIPR — reachability, infection, propagation, revealability
