question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add samples to Generator and Shrinker documentation

See original GitHub issue

While 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:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:13 (13 by maintainers)

github_iconTop GitHub Comments

2reactions
kurtschelfthoutcommented, May 31, 2016

Probably better not in this context. Unlikely it should have been part of the API in the first place anyway.

1reaction
ploehcommented, Jun 7, 2016

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found