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

Shrink with timeout instead of number #425

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

Shrink with timeout instead of number #425

cmeeren opened this issue Nov 5, 2022 · 6 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 shrinking for a certain amount of time (search this page for ShrinkingMode.BOUNDED): If a property fails, jqwik tries to shrink for (by defaut) up to 10 seconds. I'm not sure about the current Hedgehog functionality, but I am guessing it has a maximum number of shrinks instead of a time-based limit. The result is that, for complex inputs, the values may not be fully shrunk. When a property fails, I would find it much more useful to have the inputs be shrunk as much as possible, and I would have no problem waiting, say, up to 10 seconds for Hedgehog to produce the most shrunk values possible.

@moodmosaic
Copy link
Member

Perhaps @TysonMN is the one to comment on this 👀

@TysonMN
Copy link
Member

TysonMN commented Nov 11, 2022

The current default behavior is to shrink at most 100 times. That value can be set to a larger number, but shrinking cannot currently be restricted (only) by time. This seems like a reasonable request. However, I would prefer to see a motivating use case before implementing.

@cmeeren
Copy link
Contributor Author

cmeeren commented Nov 11, 2022

I consider what I said to be a motivating use case:

The result is that, for complex inputs, the values may not be fully shrunk.

I have experienced this from time to time. I don't have any code I am able to share, though.

This has previously been reported in #223.

@TysonMN
Copy link
Member

TysonMN commented Nov 12, 2022

I want an actual test someone wrote that doesn't fully shrink. I want to run the test myself. Issue #223 is blocked until you recall the test you had written.

It is ok if the test is "sanitized" to remove or replace intellectual property from an employer.

@TysonMN
Copy link
Member

TysonMN commented Nov 12, 2022

The current default behavior is to shrink at most 100 times.

Actually, the default behavior is to stop shrinking if 100 values are discarded.

@cmeeren
Copy link
Contributor Author

cmeeren commented Nov 13, 2022

I will try to keep it in mind and post such an example here the next time it happens. May be a while.

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

3 participants