Please correct me if I'm wrong, but would a precondtion not just be the postcondition of the setup?
Invariants would either have to be publically available and thus easily testable with similar methods, or, one would have to use assertions in the implemention.
I try to avoid the latter, as it mixes implemations and 'test/invariants'. Granted, there are situations (usually in code that implements something very 'algorithm'-ish) where inline assertions are so useful that it would be silly to avoid them. (But implementing algos from scratch is rare in commercial code)
Invariants would either have to be publically available and thus easily testable with similar methods, or, one would have to use assertions in the implemention.
I try to avoid the latter, as it mixes implemations and 'test/invariants'. Granted, there are situations (usually in code that implements something very 'algorithm'-ish) where inline assertions are so useful that it would be silly to avoid them. (But implementing algos from scratch is rare in commercial code)