Using the Same Tests for Two Implementations

A contract test exercises behavior that each interchangeable implementation promises, under consistent inputs and assertions.

Source
Anbloq
Language
English
Created
Updated
Chapters
2
Reading time
1 min
In this article2 chapters
  1. Trace two record stores
  2. Add implementation-specific tests where needed

Trace two record stores

An in-memory store and a database store can both promise create, read, and missing-record results. Run the same ordinary fixtures through both. See behavioral contracts.

Add implementation-specific tests where needed

A database has concurrency and migration behavior a simple in-memory implementation may not provide. Test these at the actual component boundary.[1]

References

  1. David L. Parnas, On the Criteria to Be Used in Decomposing Systems into Modules, CMU-CS-71-101 ↩