property-based_testing
This is an old revision of the document!
Table of Contents
Source: Software Testing course at ITMO university by Kochubeev Nikolay Sergeevich
Property-based testing
PBT is an approach to testing in which we test the properties of a function rather than individual examples. Instead of a single test with specific input data, the framework generates hundreds of random cases.
Strengths of PBT
- Finds hidden bugs that are not covered by specific tests.
- Expresses the behavior of the system through properties.
- Automatically generates hundreds of inputs.
- Reduces the risk of “bias”, when tests check only “convenient” cases.
Best practices
- Formulate properties at the domain level.
- Don't overuse PBT: for complex business logic, you also need regular tests.
- Use a fixed seed for reproducibility.
- Combine PBT with random-based and sample tests.
property-based_testing.1757445496.txt.gz · Last modified: by plida
