Add samples to Generator and Shrinker documentation
See original GitHub issueWhile talking to people about FsCheck I had the following idea to improve the documentation.
The documentation page https://fscheck.github.io/FsCheck/TestData.html which is generated from https://github.com/fscheck/FsCheck/blob/master/docs/content/TestData.fsx currently feels very abstract - I think it would be improved if some of the generators and shrinkers discussed would show some actual output. This would also show people how to write/test generators/shrinkers and get a feel for what they do.
Concretely, I would suggest to add executed code samples (using FSharp.Formatting’s output capturing, like in the other docs) that essentially call Gen.sample
and the shrinker function with an example value.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:13 (13 by maintainers)
Top Results From Across the Web
Test data: generators, shrinkers and Arbitrary instances
Test data: generators, shrinkers and Arbitrary instances. Test data is produced by test data generators. FsCheck defines default generators for some often ...
Read more >Understanding FsCheck
There are plenty of other generator functions available in addition to Gen.sample (more documentation here). Understanding FsCheck: Generating ...
Read more >hedgehog: Property-Based Testing
Should sampling be with replacement? Details. These generators implement shrinking. Value gen.element returns an item from the list or ...
Read more >clojure.test.check.generators documentation
Returns a single sample value from the generator, using a default size of 30. ... Create a new generator that is just like...
Read more >rapidcheck/doc/generators_ref.md at master
Returns a generator which generates the same values as gen but RapidCheck will not try to shrink it when a failing case is...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Probably better not in this context. Unlikely it should have been part of the API in the first place anyway.
I think it’d be fine to add an example of
Gen.sequence
if it’s possible to come up with an easy-to-understand example.I have to admit, however, that I still don’t understand when I’d ever use
Gen.growingElements
.If I understand the intent of this GitHub issue correctly, its purpose is to make the introduction to Generators and Shrinkers more accessible, by showing some examples. The purpose of the
TestData.html
file isn’t to act as API documentation; there’s a separate page for that.The reason I bring this up is that if we make the file too big, it’ll have a detrimental effect, because people will give up when they see the sheer size of it.