Skip to content
Latchkey

What Is Regression Testing?

Regression testing re-runs existing tests after a change to confirm that previously working features have not broken.

A regression is when a change breaks something that used to work. Regression testing guards against that by keeping a body of tests that capture known-good behavior and running them whenever the code changes. It is less a kind of test than a purpose: protecting the past while the present evolves.

What a regression is

A regression occurs when new work, a feature, a fix, a refactor, inadvertently breaks existing behavior. Regressions are insidious because the developer is focused on the new change and may not think to recheck the old one. Automated tests do the remembering for them.

The regression suite

Over time, every bug fix and feature can leave behind a test that locks in the correct behavior. Collectively these form the regression suite. A good habit is to add a regression test for each bug you fix, so the same bug can never silently return.

A quick example

After fixing a rounding bug, you add a test for the exact case that was broken, so any future change reintroducing it fails immediately.

A regression test for a fixed bug
test("rounds 2.005 correctly (was a bug)", () => {
  expect(round(2.005, 2)).toBe(2.01);
});

Keeping the suite healthy

  • Add a regression test for every bug you fix.
  • Remove or update tests that no longer reflect intended behavior.
  • Keep the suite fast so it can run on every change.
  • Treat flaky regression tests as bugs, not background noise.

Regression testing and CI

CI exists largely to run regression tests automatically on every push, so a break is caught within minutes. As the suite grows, parallelizing it across fast runners keeps the full regression pass quick, and auto-retrying transient flakes keeps the signal trustworthy. That speed and reliability is exactly what Latchkey runners aim to provide.

Key takeaways

  • Regression testing confirms old features still work after a change.
  • Add a regression test for each bug so it can never silently return.
  • CI runs the regression suite automatically on every change.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →