Skip to content
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

Run using the same seed until all tests pass #424

Open
cmeeren opened this issue Nov 5, 2022 · 0 comments
Open

Run using the same seed until all tests pass #424

cmeeren opened this issue Nov 5, 2022 · 0 comments

Comments

@cmeeren
Copy link
Contributor

cmeeren commented Nov 5, 2022

I came across a blog post on property testing that used jqwik. It seems to have some nice functionality that would be great to have in Hedgehog.

One useful feature is automatically rerunning falsified properties: If a property fails, jqwik by default uses the same seed for that property until it passes. It would be great to have this functionality in Hedgehog. The current behavior requires me to change check to recheck with the printed seed value for all failing properties to be sure that I am exposing the same failing behavior, and then change all the properties back after they pass. This is inconvenient.

I'm not sure how this can best be implemented, but I guess some temporary disk storage is needed for persistence between runs. Perhaps a temp folder with files named using a SHA256 hash of information that identifies the property (while being as robust as reasonably possible against changes to the source code), with the file contents being the seed value. If a property fails, the file is saved. If it passes, it is deleted (if it exists). Whenever a property is run, a seed is taken from the matching file, if it exists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant