Re:A survey of testing techniques we've found useful
by epdlxjmonad on Saturday April 11, 2020 @11:51AM
(#22842278)
Yes, closely related, but invariants can appear anywhere in the code (like loop invariants), and are less restrictive than pre-conditions and post-conditions which must appear in the beginning and end of methods. So, invariants are more about testing than design.
Arguably, invariants are especially powerful in testing distributed systems:
0 - https://en.wikipedia.org/wiki/Design_by_contract