4 ms·
Property-based tests do this at runtime too (and they catch far more bugs than you'd imagine going into it).
by aassddffasdf 7y ago
Property-based tests do this at runtime too (and they catch far more bugs than you'd imagine going into it).
- seanwilson 7y agoProperty-based tests are really practical and will find bugs unit tests don't, but type checking is an exhaustive proof that the properties you've expressed with types hold for all inputs/outputs. A key point though is the type systems of most mainstream languages don't let you express complex program properties (e.g. the input list must be sorted), so your only option is to use unit tests or similar to check those.
- aassddffasdf 7y agoYes, I know that. However, they don't need to be exhaustive. They are very effective at uncovering any bugs using a statistical approach at even very reasonable levels of iteration. And nothing precludes you from running them 24/7 in the cloud. I wouldn't say using a "unit test" is ever really a viable option for me. Property-based tests subsume unit tests.