Regression Testing: Stuart Anderson
Regression Testing: Stuart Anderson
Stuart Anderson
Regression Testing
• Regression testing is applied to code immediately after changes are made.
• The goal is to assure that the changes have not had unintended consequences
on the behaviour of the test object.
• We can apply regression testing during development and in the field after the
system has been upgraded or maintained in some other way.
• Good regression tests give us confidence that we can change the object of test
while maintaining its intended behaviour.
• So, for example, we can change to a new version of some piece of infrastructure
in the environment, make changes to the system to take account of that and
then ensure the system behaves as it should.
• Regression testing is an important way of monitoring the effects of change.
• There are many issues but the balance of confidence against cost is critical.
• Bad reasons:
– Arguments in terms of replicability of results (i.e. scientific analogy).
– Arguments in terms of quality in analogy with a production line (i.e. a
manufacturing analogy).
Risks of Change
• Bug regression testing: checks that a bug fix has removed the symptoms of
the bug that have been identified.
• Old fix regression: checks that a new fix has not broken an old fix: refactoring
should limit this as old fixes are refactored into the code.
• Functional regression: new code or fix has not broken previously working
code.
• Incremental Regression testing: regression testing as we develop.
• Localisation Testing: tests if a product has been correctly localised for a
particular market.
• Build Testing: has an error been introduced in the field that means the
system will not build correctly.
A ‘Model’
[This analogy was first presented by Brian Marick. These slides are from James Bach]
[Bach]
[Bach]
[Bach]
Economic Perspective
• What is the best way to improve product quality?
– Maintain a regression test set
– Develop new tests
– It is possible to develop new tests for low value events (e.g. patch bundles)
• Costs:
– How much does it cost to maintain tests?
– How much does it cost to create tests?
• Issues about how to integrate many unit level test sets that have been created
individually.
Risk Management
• Tests target critical behaviour the main hazards.
• For embedded systems we have good specifications and it may be possible to
infer more from a test result.
• We can use combinations of old tests to exercise the system more extensively
on retest:
– More tests.
– More combinations of test.
– More variants.
– With a good specification we can see how the tests cover the different
behaviours of the system.
– We provide independent testers with a large armoury of possible weapons
to break the system.
Summary
• Regression testing provides a tool for managing change.
• Regression testing can be used throughout the lifecycle.
• It can reduce the cost of applying tests (by storing the expected result).
• It is a tool in helping to provide stability in the face of code change.
• Costs of test maintenance and test reuse are very variable but in some
environments it is affordable.
• Standards and regulation often require regression testing.
• The analogy between a manufacturing environment and a software production
environment is very weak.
• The role of testing in the two environments is quite different.
Required Readings
• Textbook (Pezzè and Young): Chapter 22, System, Acceptance, and
Regression Testing