liveBook · Manning

Regression

As explained in Unit Testing Principles, Practices, and Patterns

A regression is a defect in which a feature that previously worked stops working as intended after a change or other event.

A regression is a defect in which a feature that previously worked stops working as intended after an event, usually a code modification. Regression and software bug are interchangeable terms. section 1.2

Changes increase codebase disorder, so regressions can accumulate as features are added or code is refactored. Unit tests act as a safety net by checking that existing functionality continues to work. section 1.2 section 1.6

Regression prevention depends on the quality and value of the test suite:

  • Good tests increase confidence during refactoring and feature development. section 1.6
  • Bad tests or no tests can still lead to stagnation and repeated regressions. section 1.6
  • Coverage can reveal trouble, but high coverage does not prove that regressions will be caught. section 1.6

After a refactoring change

A previously working feature behaves incorrectly after refactoring. Tests that verify the existing behavior expose the regression before the change reaches a later release. section 1.2 section 1.6

Figure 1.1. The difference in growth dynamics between projects with and without tests. A project without tests has a head start but quickly slows down to the point that it’s hard to make any progress.

The project-growth comparison illustrates why tests help prevent regressions from turning ongoing development into stagnation. section 1.2

How Unit Testing Principles, Practices, and Patterns covers it

How deep it goes
Defines changed behavior after an event, usually code modification, but does not detail regression diagnosis.
Examples
Uses feature changes, refactoring, releases, and tests as contexts where regressions appear or are prevented.
What you can do after
Evaluate whether tests provide confidence that changes will not break existing functionality.
How it connects
Connects regression to software bugs, unit testing, refactoring, code deterioration, and coverage metrics.

Also explained in

Compare how 5 books explain regression →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Unit Testing Principles, Practices, and Patterns. The section links point to the parts of the book it draws on.