Characterization test

Characterization test

In computer programming, a characterization test is a means to describe (characterize) the actual behaviour of an existing piece of software, and therefore protect existing behaviour of legacy code against unintended changes via automated testing. This term was coined by Michael Feathers [1]

The goal of characterization tests is to help developers verify that the modifications made to a reference version of a software system did not modify its behaviour in unwanted or undesirable ways. They enable, and provide a safety net for, extending and refactoring code that does not have adequate unit tests.

When creating a characterization test, one must observe what outputs occur for a given set of inputs. Given an observation that the legacy code gives a certain output based on given inputs, then a test can be written that asserts that the output of the legacy code matches the observed result for the given inputs. For example, if one observes that f(3.14) == 42, then this could be created as a characterization test. Then, after modifications to the system, the test can determine if the modifications caused changes in the results when given the same inputs.

Unfortunately, as with any testing, it is generally not possible to create a characterization test for every possible input and output. As such, many people opt for either statement or branch coverage. However, even this can be difficult. Test writers must use their judgment to decide how much testing is appropriate. It is often sufficient to write characterization tests that only cover the specific inputs and outputs that are known to occur, paying special attention to edge cases.

Unlike regression tests, to which they are very similar, characterization tests do not verify the correct behaviour of the code, which can be impossible to determine. Instead they verify the behaviour that was observed when they were written. Often no specification or test suite is available, leaving only characterization tests as an option, since the conservative path is to assume that the old behaviour is the required behaviour. Characterization tests are, essentially, change detectors. It is up to the person analyzing the results to determine if the detected change was expected and/or desirable, or unexpected and/or undesirable.

One of the interesting aspects of characterization tests is that, since they are based on existing code, it's possible to generate some characterization tests automatically. An automated characterization test tool will exercise existing code with a wide range of relevant and/or random input values, record the output values (or state changes) and generate a set of characterization tests. When the generated tests are executed against a new version of the code, they will produce one or more failures/warnings if that version of the code has been modified in a way that changes a previously established behaviour.

References

  1. ^ Feathers, Michael C. Working Effectively with Legacy Code (ISBN 0-13-117705-2).

External links


Wikimedia Foundation. 2010.

Игры ⚽ Нужна курсовая?

Look at other dictionaries:

  • Test de la sueur — Mucoviscidose Mucoviscidose Autre nom Fibrose kystique du pancréas Référence MIM …   Wikipédia en Français

  • Enterprise test software — (ETS) is a type of software that electronics and other manufacturers use to standardize product testing enterprise wide, rather than simply in the test engineering department. It is designed to integrate and synchronize test systems to other… …   Wikipedia

  • Engine test stand — An engine test stand is a facility used to develop, characterize and test engines. The facility, often offered as a product to automotive OEMs, allows engine operation in different operating regimes and offers measurement of several physical… …   Wikipedia

  • Direct shear test — A direct shear test also known as shearbox test is a laboratory or field test used by geotechnical engineers to measure the shear strength properties of soil[1][2] or rock[2] material, or of discontinuties in soil or rock masses.[3] …   Wikipedia

  • Trinity-Test — Kernwaffentest Trinity Test Trinity Explosion (sog. Feuerblase 0,016 Sek. nach Zündung.[1] ) Informationen Nation Vereinigte Staaten …   Deutsch Wikipedia

  • Cone penetration test — A CPT truck operated by the USGS. The cone penetration test (CPT) is an in situ testing method used to determine the geotechnical engineering properties of soils and delineating soil stratigraphy. It was initially developed in the 1950s at the… …   Wikipedia

  • Round robin test — In experimental methodology, a round robin test is a test (measurement, analysis, or experiment) performed independently several times. This can involve multiple independent scientists performing the test with the use of the same method in… …   Wikipedia

  • MTT-Test — Der MTT Test ist ein Zytotoxizitäts Test. Zellen werden in vitro mit dem namensgebenden Farbstoff, einem gelben Tetrazoliumsalz, behandelt, um ihre Lebensfähigkeit beziehungsweise den Anteil lebender Zellen im Vergleich zu einer Kontrollprobe von …   Deutsch Wikipedia

  • hapten inhibition test — serologic characterization of an antigenic determinant by employing known haptens to mask the antigen binding site of antibody specific for it …   Medical dictionary

  • Unit testing — In computer programming, unit testing is a method by which individual units of source code are tested to determine if they are fit for use. A unit is the smallest testable part of an application. In procedural programming a unit may be an… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”