DEV Community

Discussion on: From 1 to 10,000 test cases in under an hour: A beginner's guide to property-based testing

 
fornwall profile image
Fredrik Fornwall

Thanks for the discussion!

Regarding how design by contract (which at least JML is about) might relate to property-based testing I found a post which actually combines hypothesis (for property-based testing) with dpcontract (for design by contract):

Maybe they complement each other: “your code doesn’t violate any contracts” counts as a PBT invariant. Maybe we can generate inputs that match the preconditions and confirm that all of the postconditions (and preconditions of other called functions) are preserved.

I also like the following comment (from softwareengineering.stackexchange....

The relationship is that the combination of design by contract and the testing methods are attempting to substitute for a correctness proof, which would be the ultimate goal, if it were feasible.