Regression Testing
- In Turkish
- Regresyon Testi
In short
Regression testing is the practice of re-running existing tests after a code change to make sure that features which used to work have not broken.
What is regression testing?
Regression testing checks that new changes haven't broken old behavior. A regression is a bug in something that previously worked, such as a login page that fails after an unrelated update to the checkout code. Regression testing means running the existing tests again after every change to catch these problems early.
In practice, the regression suite is simply your collection of automated unit, integration, and end-to-end tests, run by a CI/CD pipeline on every commit or pull request. When a bug is found and fixed, developers add a test that reproduces it, so the same bug can't quietly come back. Large projects sometimes run a fast subset on every commit and the full suite nightly.
An analogy is a pilot's pre-flight checklist: even if only one part of the plane was repaired, the whole checklist is run again, because a fix in one place can affect another. Regression testing matters most in large, long-lived codebases, during refactoring, and when upgrading dependencies.
Regression testing is not a separate kind of test like a unit test; it describes a purpose. Any test becomes a regression test when you run it again to protect existing behavior. It is also different from testing a new feature, which checks behavior that didn't exist before.
Key takeaways
- A regression is a bug in something that used to work.
- Regression testing re-runs existing tests after every change.
- Automated test suites in CI/CD make regression testing cheap and constant.
- Every fixed bug should get a test that prevents it from returning.
Example
# Bug report: parse_price("1,299.00") crashed because of the comma.
def parse_price(text):
return float(text.replace(",", ""))
# Regression test: reproduces the old bug so it can never quietly return.
def test_parse_price_with_thousands_separator():
assert parse_price("1,299.00") == 1299.0Readers ask
What is the difference between regression testing and retesting?
Retesting checks that a specific bug fix actually works. Regression testing checks that the fix, or any other change, didn't break other features that were already working.
Should regression testing be automated?
Yes, wherever possible. Repeating the same checks by hand after every change is slow and error-prone, while an automated suite in a CI/CD pipeline can run on every commit in minutes.
See also
- Unit TestTesting & Quality, p. 35A unit test is a small, automated check that verifies one function, method, or class behaves correctly in isolation from the rest of the program.
- End-to-End TestTesting & Quality, p. 8An end-to-end test is an automated test that runs a complete user journey through the whole application, from the user interface to the database and back.
- CI/CDDevOps & Cloud, p. 9CI/CD is a set of automated practices that build, test, and release code changes frequently, so software can be delivered to users quickly and safely.
- RefactoringSoftware Architecture, p. 33Refactoring is the process of restructuring existing code to make it cleaner and easier to maintain without changing what the code does from the outside.
- Test CoverageTesting & Quality, p. 30Test coverage is a metric that measures how much of a program's source code is executed when its automated tests run, usually shown as a percentage.
- CommitVersion Control, p. 5A commit is a saved snapshot of a project's files in Git, recorded with a unique ID, an author, a timestamp, and a message describing what changed.
- Test AutomationTesting & Quality, p. 28Test automation is using code to run tests and check their results, so the same checks repeat quickly and consistently on every change instead of by hand.
Spotted a mistake or something missing on this page?Suggest an edit