Property Tests + Contracts = Integration Tests

1 · Hillel Wayne · Dec. 17, 2017, midnight
I’m a pretty big fan of contracts and property-based testing. While they’re both powerful, they do have tradeoffs: Contracts are simple and allow for complex conditionals, but you need to test them over a wide space to confirm them. Property-Based Testing can test your code over a very wide search space, but you have to come up with good generators and invariants. Maybe they complement each other: “your code doesn’t violate any contracts” counts as a PBT invariant....