Regression Testing
Preserving Behaviour After Software Changes
Regression testing checks whether a software change has caused unintended effects in previously working behaviour. You use it after repairs, enhancements, configuration changes, or dependency updates. The changed feature may work correctly while another feature breaks because it shares data, services, or assumptions with that feature. Your task is to gather evidence that behaviour which should remain intact still meets its requirements.
What behaviour are you protecting?
Begin by separating intended changes from unintended consequences. A new requirement may legitimately change an output; regression testing does not require every output to remain identical. It checks preserved requirements and interactions against their expected results.
Distinguish this purpose from confirmation testing. The same test can serve both purposes at different times: first it confirms a repair, and later it helps detect a recurrence.
Testing purpose | Main question | Example after a date-handling repair |
|---|---|---|
Confirmation | Does the reported problem now behave correctly? | Repeat the date input that triggered the reported problem. |
Regression | Has previously working behaviour been harmed? | Check existing recurring bookings and calendar exports that use date handling. |
Example: A price-formatting change may display the new currency correctly while accidentally dropping decimal places from receipts. Testing only the new currency would miss that unintended effect.
Choosing work after a change
A regression suite is a maintained collection of tests used to check for unintended effects after changes. It can include checks at different levels, from individual components to complete user workflows. Its value depends on meaningful expected results and relevant coverage, rather than test count alone.
You can rerun the full available suite, select a subset, or prioritize execution. Selection determines which tests run; prioritization determines their order. If every test eventually runs, changing the order alone does not reduce total execution work, although it can expose important failures earlier.
Select tests using the change, affected dependencies, business consequences, and previous failures. Shared components and high-consequence workflows deserve particular attention. Selection depends on the completeness of your impact information: a missing dependency can cause you to omit the very test that would reveal a regression.
For tests running sequentially, with setup time excluded or already included in each duration, the execution-time model is
Here, S is the selected set and ti is the duration of test i. Parallel execution or shared setup requires a different timing model. A reduction in execution time measures saved time; it does not measure the proportion of defects you can detect.
Trusting the evidence
Each test needs a justified expected result. That expectation acts as a test oracle. Preserve expectations for unchanged requirements, and update them deliberately when requirements change. Replacing an expected result merely because a test fails can hide a regression.
Investigate failures before attributing them to the product change. Compare the relevant versions under controlled conditions, inspect test data and configuration, and check whether the failure is reproducible. A flaky test weakens the evidence and needs investigation; a successful retry does not explain its earlier failure.
Maintain the suite as the software evolves. Retain useful tests for repaired problems, remove obsolete expectations deliberately, and record gaps left by selective runs. Report what ran and what was omitted so others can judge the remaining risk.
What to remember
- Check preserved behaviour after a change, including affected callers.
- Separate choosing tests from choosing their execution order.
- Interpret time savings separately from detection capability.
- Investigate failures and state the limits of passing results.
Example: Protecting Room Bookings After a Parser Change
A campus booking service changes its shared date parser. The team uses regression test selection, choosing which existing checks to rerun after a change. Its reviewed dependency model identifies recurring bookings and calendar export as the parser's only callers; account editing does not use it. For this example, assume that model is complete and that requirements for all existing date formats remain unchanged.
The team runs complete batches sequentially. Durations include setup, and there is no additional overhead.
Batch | Behaviour checked | Duration (s) |
|---|---|---|
P | Date parser | 18 |
R | Recurring bookings | 42 |
E | Calendar export | 30 |
A | Account editing | 60 |
a) Which batches form the dependency-based regression selection?
Start with the changed component: batch P checks the date parser itself. Then follow its callers: recurring bookings and calendar export require batches R and E. Account editing has no dependency on the parser under the stated model.
The selection is P, R, and E. Omitting A is justified by the example's complete dependency model, rather than by its duration. In a real system, incomplete dependency information would leave uncertainty about that omission.
b) Calculate the selected execution time and its percentage reduction relative to running every batch.
First add the parser and recurring-booking durations. Their subtotal is ________. Then include calendar export:
The full-suite duration is ________, found by including account editing:
Subtract the selected time from the full time. The time saved is ________. Express that saving relative to the full run:
The selected run takes 90 s, a 40% reduction in execution time. This percentage describes time saved, not a percentage of defects detected.
c) Batch E now reproducibly exports an incorrect date. It passes on the previous version with matching input, data, and configuration. Should the team update the expected date to match the new output? Explain the next action.
The requirement for this existing date format is unchanged, so the justified expected date remains unchanged. A new output is not automatically a new correct output.
The controlled comparison provides evidence of a regression associated with the version change, although it does not by itself locate the faulty statement. Preserve the failing case and investigate the parser-to-export interaction. After an evidence-supported repair, rerun E to check the repair and rerun P and R to check for further unintended effects.
The decision is keep the justified expected date and investigate the regression, rather than changing the test to accept the incorrect export.
A regression suite is a collection of tests used to check previously tested behaviour after software changes. A delivery-service team reviews four independent maintenance situations. Match each action to the situation that justifies it.
Delivery-fee rules are unchanged, and the current assertion still agrees with the approved requirements.
A discount-rounding bug has been reproduced and corrected, but no automated case exercises the input that exposed it.
An approved requirement changes the free-delivery threshold, and the existing assertion uses the former threshold.
A delivery option has been formally withdrawn, and a review confirms that its old acceptance assertion serves no remaining requirement.
Revise the expected result
Retain the existing check
Add a check for the repaired defect
Retire the obsolete check
A regression suite takes 84 min to run in full. An impact-based selection takes 30 min. Both runs execute sequentially, and these times include all setup. Calculate the percentage reduction in execution time relative to the full suite. Answer in percent, to one decimal place.