ImplementationCompatibilityTest

From APIDesign

Jump to: navigation, search

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:

does not exists: total.rewrite.oldimpl

and here is a RandomizedTest to check the compatibility of new and old implementation:

does not exists: total.rewrite.compare
Personal tools
buy