← CodeClarityLab Home
Browse by Category
+ added · updated 7d
← Back to glossary

Regression Testing

testing Beginner

Also Known As

regression suite regression test

TL;DR

Re-running existing tests after code changes to verify that previously working functionality has not been broken — the primary safety net for continuous delivery.

Explanation

Regression testing encompasses all tests that verify known-good behaviour is preserved after a change. In CI/CD, the entire test suite is a regression suite — every commit runs all tests to catch regressions early. The cost of regression testing is proportional to test execution time, which is why the test pyramid (many fast unit tests, few slow E2E tests) optimises for fast regression feedback. Mutation testing extends regression testing by verifying that the tests themselves are meaningful.

Common Misconception

Regression testing is a separate testing phase — in modern CI/CD, all tests run on every commit and collectively serve as the regression suite.

Why It Matters

Without regression tests, every change risks silently breaking existing features — the larger the codebase, the more likely an unrelated change introduces a regression.

Common Mistakes

  • Not running regression tests on every commit — regressions compound when multiple unverified changes accumulate.
  • Slow regression suite that developers skip locally — fast feedback loops require tests to run in minutes.
  • Not adding a regression test when fixing a bug — without a test, the bug returns silently.
  • Deleting tests that are 'in the way' of a refactor — they are protecting against regression.

Code Examples

✗ Vulnerable
// Bug fixed without adding a regression test:
// Report: calculate_discount() returns negative for items over $1000
// Fix applied — but no test added
// Next refactor: same bug reintroduced, silently
function calculate_discount(float $price): float {
    return $price > 100 ? $price * 0.1 : 0; // Bug: should be $price - $price * 0.1
}
✓ Fixed
// Bug fixed WITH a regression test:
function testDiscountNeverExceedsPrice(): void {
    $discount = calculate_discount(1500.00);
    $this->assertGreaterThanOrEqual(0, 1500.00 - $discount); // Price never goes negative
    $this->assertLessThanOrEqual(1500.00, $discount); // Discount never exceeds price
}

Added 15 Mar 2026
Edited 22 Mar 2026
Views 33
Rate this term
No ratings yet
🤖 AI Guestbook educational data only
| |
Last 30 days
0 pings W 0 pings T 0 pings F 0 pings S 0 pings S 0 pings M 1 ping T 0 pings W 0 pings T 0 pings F 1 ping S 2 pings S 0 pings M 0 pings T 0 pings W 0 pings T 1 ping F 2 pings S 2 pings S 0 pings M 0 pings T 0 pings W 0 pings T 2 pings F 1 ping S 0 pings S 0 pings M 0 pings T 0 pings W 0 pings T
No pings yet today
No pings yesterday
Perplexity 10 Amazonbot 7 Google 5 Ahrefs 2 Unknown AI 2 ChatGPT 2 SEMrush 1
crawler 27 crawler_json 2
DEV INTEL Tools & Severity
🟠 High ⚙ Fix effort: Low
⚡ Quick Fix
Write a test reproducing every bug before fixing it — the test proves the bug exists, ensures the fix works, and prevents the bug from reappearing silently
📦 Applies To
any web cli queue-worker
🔗 Prerequisites
🔍 Detection Hints
Bug fixed without a corresponding test; same bug reported multiple times; no test suite to detect regressions
Auto-detectable: ✗ No phpunit pest github-actions
⚠ Related Problems
🤖 AI Agent
Confidence: Low False Positives: High ✗ Manual fix Fix: Medium Context: File Tests: Update

✓ schema.org compliant