2 ms·
The power of property-based testing is very appealing. I want to make sure people have realistic expectations though - it’s difficult to express properties for
by amw-zero 6y ago
The power of property-based testing is very appealing. I want to make sure people have realistic expectations though - it’s difficult to express properties for a lot of typical application behaviors. And, even if you can think of a property, that also doesn’t guarantee that you haven’t missed another property that’s necessary for sufficiently proving that some behavior works as expected. For example, both addition and subtraction are commutative. Testing for commutativity alone wouldn’t show that you’ve implemented either one correctly.
That being said, I think generative testing is the future. After TDDing for years, I believe it does not live up to the value proposition of preventing bugs (it’s still good as a means to guide you toward implementing the next behavior of course). Its main weakness is that one passing test case provides almost no guarantee that other cases will pass. For complicated domain models, this means creating tons of test data which is time consuming and also immensely gets in the way of refactoring the data model.
So I think generating test inputs is absolutely the way to go. It is just harder on a per-test basis than the main example-based flow that a lot of us do today.