New page: Very useful style of tests to ensure BackwardCompatibility when doing major rewrite of an implementation behind an API. Discussed in details in Chapter 15. The basic idea cons...
New page
Very useful style of tests to ensure [[BackwardCompatibility]] when doing major rewrite of an implementation behind an [[API]]. Discussed in details in [[Chapter 15]].
The basic idea consist of copying the original implementation of an [[API]] into the test and then performing various calls into the [[API]] twice (in the new and old implementation) and then ensuring the result is the same.
For an example see this style applied to old good '''Arithmetica''' class introduced in [[AlternativeBehaviour]]. Here is the copy of old implementation:
<source lang="java" snippet="total.rewrite.oldimpl"/>
and here is a (randomized) test to check the compatibility of new and old implementation:
<source lang="java" snippet="total.rewrite.compare"/>