Description
Our sister framework Hypothesis has a feature they call "The Database" where they serialize counterexamples to disk then run them before they start the actual testing loop.
I have some gut reactions to this, so I've laid out some problems that needs to be addressed first
- Attaching mutable external state to tests
I'm most worried about this. Hypothesis goes to quite a lot of effort to make sure their example database is consistent and useful and even then they break it every so often between releases. On the one hand, it is incredibly useful - especially while practicing TDD - to write a property and have the framework just track your counterexamples, but there's got to be a less flaky way.
- Universal serialization
Python kind of has it easy - everything is a key-value store at the end of the day, so everything serializes for free: pretty much all of the python middleware frameworks are capable of automatically deriving what would need to be Codable
and Decodable
instances for data.
- Decreased test example diversity
The expected user model when a test fails now becomes
- fail test
- serialize counterexamples
- rerun test with only counterexamples
This would seem to encourage growing test suites that exist solely to run through counterexamples which is not the point of property testing.