-
Notifications
You must be signed in to change notification settings - Fork 39
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
Re-add Fuzz.andThen? #17
Comments
I'd say let's wait with re-adding this one, and see if we can improve the shrinking/fuzzing significantly first, because we don't have andThen. Also, see how many people actually miss it in 0.19. |
I miss it. :( I have tests for my game which uses a 2D board. There's a fuzzer which takes a board dimension fuzzer (which returns |
I miss it. Having a structure with fuzzed uuids and foreign key relation and constraints between data, that should be generated. It's possible with |
i miss it. I cant move forward with my project - i spent 3 days on this issue already. Given i didn't know much about shrinkers and stuff - needed to learn it first - still was not very fast. And im not sure how to do it even after all the research and testing i've done.
How would you build a |
I have a case that I don't think I can solve without something like
This helper works! But I want to repeat a variable number of times by using What I need is a way to return a new Fuzzer based on the result of a previous Fuzzer, which seems like exactly what
Anyway, hoping this can serve as an example of where |
Fuzzers have two pieces: generators, and shrinkers. You can use We know it's hard to write your own shrinker right now; there are some changes coming in the next version. But disregarding any technical limitations, we think that making a general-purpose shrinker with As a small concession, maybe we could say @neoncrisis What's wrong with |
@mgold I was able to work around my problem using Fuzz.custom 🙂. The reason Fuzz.list doesn’t work for me is that I’m testing encoders/decoders round trip and our encoders enforce the length and allowable characters of certain string e.g., zip code, phone number, ssn, &c. The best way I was able to control the length of strings is by building them from a list of Char whose length I control. |
That confirms what we think: for types/data structures with sufficiently complex business logic, you need to write separate generators and shrinkers. A generic shrinker wouldn't know anything about your length requirements; a custom one would know not to turn a legitimate failure into malformed data. |
Yes, I think it would be good. I think shriking is nice and all, but not as valuable as data generation itself. Being able to create fuzzer using |
I miss |
So, this is clearly an issue that a lot of people have weighed in on. Although the top of the thread mentions We've been saying to use So here's an idea:
Optionally: I think all of that is, you know, actually possible to implement. |
https://discourse.elm-lang.org/t/elm-explorations-test-2-0-0-released/8705 |
I'm glad we finally have Fuzz.andThen without any shrinking compromises 🎉 |
It's nontrivial to get
Fuzz.andThen
working in 0.19 because the 0.18 version implementation relied onDebug.crash
.Perhaps we should re-add
Fuzz.andThen
as aMINOR
release, with more helpful error messages in the event that you give it an invalid fuzzer.The text was updated successfully, but these errors were encountered: