Closed zhoucheng361 closed 10 months ago
We have general advice at https://github.com/HypothesisWorks/hypothesis/blob/master/guides/strategies-that-shrink.rst, and the same principles apply for stateful testing.
There's no way to control shrinking separately from how you implement your strategies and test code; the main tip is to ensure that (1) a small example is possible, and (2) making local changes will produce similar valid/failing inputs.
For any further questions, I'd recommend Stack Overflow.
I write a stateful test to test the ACL feature, when I run the test with shrink enabled , I got a failure example including 56 steps. I wonder how I can optimize my testing code to let it shrink more effectively? Another question is , when I got a long steps failure example, can I do shrink based on it with hypothesis framework?
cat .github/scripts/fsrand2.py
Run the test:
MAX_EXAMPLE=100 STEP_COUNT=100 python3 .github/scripts/fsrand2.py
Check the fail example
here is what I got after the test , the failure example include 56 steps, which is not shrunk effectively.