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.

How does this compare to proptest?

See original GitHub issue

Hello. I just stumbled upon this library. It looks really nice 👍

I’ve been using property-based testing with great success to find bugs in an immutable list implemented in TypeScript. It’s really good to see a great looking TS implementation of property-based testing. The library I’ve been using is proptest. Would you happen to know how this library compares to Proptest?

One thing I really like about Proptest is the following (from the readme):

Shrinking is done by generating lazy rose trees of values directly. This means that you can map and chain generators and get correct shrinking functions “for free”.

That is, the generators (which is what fast-check calls arbitraries) in Proptest are monads. It is possible to map them, chain them, and more. As far as I can see fast-check has a map function for its arbitraries but no monadic bind?

Additionally, Proptest has a nice integration with testing frameworks. See the example here. It makes it possible to declare tests in a really concise way. Have you considered adding something similar to fast-check?

Having to write fc.assert( seems a bit cumbersome. Have you considered adding a function that is the composition of the two?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

dubzzzcommented, Jun 9, 2018



I just had a look into proptest (looked at the code and played with it). It indeed comes with a built-in chain method.

Unfortunately, it has the same problem as the one I decribed above concerning the poor shrinking of such chaining. In the case of this precise framework, a chained value is only shrunk on the last dimension - the chain of fast-check shrinks on both dimensions.

Moreover, this chain method is used to build .array() in proptest, so the impact of the poor shrinking is easily visible.

If you have a look into You’ll see that for the property:

an array of natural numbers never contains a 8 (obviously false)

Counterexample for proptest: [8, 0, 0, 0, 0, 0, 0] Counterexample for fast-check: [8]

other remarks

I think that the output of proptest could have been more verbose. For instance, it does not specify the seed that was used.

It also fails to generate large values by its own (certainly needs a manual intervention):

// this one was always true in my case
  'all natural numbers are inferior to 1000',
  x => x < 1000);
dubzzzcommented, Jun 28, 2018

@paldepind You might be interested: I started working on your idea to merge assert, property and it all together. The current proposal is described in #109.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Comparing More Than 2 Proportions - SPH - Boston University
To compare k ( > 2) proportions there is a test based on the normal approximation. It consists of the calculation of a...
Read more >
Using R's prop.test function to compare subsets of a population
It seems your real question is less about prop.test and more about understanding how to test for a difference in proportions, with a...
Read more >
proptest - Rust -
Proptest is a property testing framework (i.e., the QuickCheck family) inspired by the ... The QuickCheck approach has a lot of disadvantages in...
Read more >
prop.test: Test of Equal or Given Proportions -
test can be used for testing the null that the proportions (probabilities of success) in several groups are the same, or that they...
Read more >
Test of Equal or Given Proportions - R
prop.test can be used for testing the null that the proportions (probabilities of success) in several groups are the same, or that they...
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 Post

No results found

github_iconTop Related Hashnode Post

No results found