Since properties are an abstraction level higher than the examples, it's easy to implement them in a confusing or unclear manner. You already need to pay a lot of attention to example-based tests; you now need to up your efforts in relation to the property-based tests.
First of all, good properties are like good unit tests. We want, therefore to have properties that are as follows:
- Small
- Named appropriately and clearly
- Giving a very clear message when they fail
- Fast
- Repeatable
There's one caveat with property-based tests though—since we're using random values, shouldn't we expect random failures? Well, when a property-based test fails, we learn something new about our code, so it's a reason for celebration. We should expect, however, to have fewer failures as time passes by and we remove our bugs. If your property...