Property-based testing
Fuzz testing is a great step forward when testing edge cases in our application. We can think of it as analogous to chaos testing, where we test a huge variety of edge cases in the hope of detecting an error. However, we do not have any control over the random inputs. This leads to two problems:
- We test a large number of irrelevant scenarios that are unlikely to happen in our system.
- We don’t know whether the scenarios that really matter have been covered by our fuzzed tests. Instead, it would be great if we had a more structured approach available to us.
Property-based testing is a testing technique that involves testing a program against a set of properties or specifications that are important to our user journeys and system behavior. This allows engineers to follow a systemic approach to testing, as opposed to focusing on verifying inputs.
In property-based testing, we generate random inputs that satisfy the set of constraints...