|
|
|
|
|
by asgard1024
2117 days ago
|
|
> Tests that use random input data are much more difficult to write correctly. Interestingly, I personally find them easier to write. I actually find classic unit tests hard to write, probably because I am painfully aware of the lack of coverage. While with property-based testing, I start from the assumption I have on what the code should do. Then the test basically verifies this assumption on random inputs. Doing unit test with the given input seems to me backwards - it's like a downgrade, because I always start from what kind of assumption I have and based on this I choose the input. And why not encode the assumption, when you already have it in your mind anyway? |
|
You have many more tests than implementations. In my experience, ~20x more. If your tests had bugs at the same rate as your implementation, you'd spend 95% of your time fixing test bugs and 5% fixing implementation bugs. That's why tests should be simple.
If you're going to be spending that much time on validating assumptions, I think you're better off trying to express them formally.