-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make it easier to re-run failed fuzz tests with verbose logging #7206
Comments
I love #2551 - it's not quite the UX I'm talking about but seems super useful nonetheless. I'd love to be able to quickly retest failing inputs after I tweak code. #2552 is similar. The UX I'm looking for though is to specifically get more info about why a fuzz test failed. I think the simplest version of the UX I want is just to add a flag like I think that'd satisfy my needs without needing to store things between runs! |
We have some pretty extensive logging in our tests - it'd be nice, when the test failed, to see that logging so I can go debug the failure itself. The issues you linked seem more suited to "after I debug and fix the broken code, how can I ensure the same inputs succeed this time". Very valuable, but not what I opened this issue for. |
the way #2551 is implemented is that when a fuzz failure occurs it is persisted and always replayed first on subsequent runs, so the test will exit right away. If I am not missing something I think you can have the behavior you're looking for by rerunning the failed test with function test_replayFuzz(uint256 x) public {
require(x != 3, "failed");
} when failure is hit is recorded
then if you rerun
Mind that when running again there is a single run (vs 157 originally) with the failed case, would this help? @wadealexc |
Ah, that seems like it would work for my use case! Thank you :) |
Component
Forge
Describe the feature you would like
Currently ~90% of our test suite uses fuzzy parameters. When we run our entire test suite, we occasionally get flaky test failures because we haven't properly filtered certain inputs with
vm.assume
(or maybe tests fail for another reason).When fuzz tests fail due to specific input, the test runner helpfully displays the test input in red text - but if I want to go run that failed test using the provided input, I have to do a long workaround with
forge script
, to rerun this test and view the logs.Ideally I could do something like
forge test --last-failed -vvvv
or something to just rerun the last failed fuzz tests with logs turned on!Additional context
No response
The text was updated successfully, but these errors were encountered: