DEV Community

Discussion on: How to test software effectively

Collapse
 
eljayadobe profile image
Eljay-Adobe

My biggest ire against unit tests is not regarding unit testing itself, but it is due to languages that do not support design by contract.

For those languages (which is most languages) unit tests are a means to fill in that gap. But unit tests pale in comparison to having contracts. Contracts can alleviate the need for a majority of unit tests, and much better express the intent, and unlike unit tests contracts don't "rot over time" (or as Coplien would phrase it, unit tests become muda because of the effort of maintaining them).

One of my favorite languages, D — as part of the core language — supports both contracts and unit tests, as first class language constructs.