Software Engineering basics - Regression testing

Regression testing is a type of software testing that ensures that recent code changes (like bug fixes, updates, or new features) haven’t accidentally broken or altered existing functionality.

Here’s a clear breakdown:


1. Purpose

The goal of regression testing is to verify that previously developed and tested software still works as expected after changes such as:

  • New features added

  • Code refactoring or optimization

  • Bug fixes

  • Integration with new modules or systems


2. When It’s Done

Regression testing is usually done:

  • After every code change, especially in agile or continuous integration environments.

  • Before a release, to make sure updates didn’t introduce new defects.


3. How It’s Done

There are two main ways:

  • Manual regression testing: Testers re-execute a selected set of test cases manually.

  • Automated regression testing: Automation tools (like Selenium, JUnit, Cypress, or TestNG) run test scripts automatically — this is faster and more reliable for large or frequently updated projects.


4. Test Selection

You don’t always rerun every test. Teams often choose:

  • Smoke tests: To check critical functionalities.

  • Test suites for affected areas: Based on the parts of code that changed.

  • Full regression suites: For major releases or system-wide changes.


5. Example

Suppose you add a new “discount code” feature to an e-commerce app.
Regression testing would check:

  • The checkout process still works.

  • The total price calculation remains correct.

  • Payment and order confirmation screens still function properly.


6. Benefits

  • Detects unintended side effects early

  • Ensures software stability and quality

  • Builds confidence before deployment

  • Supports continuous delivery