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.

Manually add concrete examples to test

See original GitHub issue

Consider the following scenario: Through usage, a bug is discovered in a function for some concrete input. In order to test the bug and potentially shrink the input a property based test is created. But, it turns out that none of the random values that the property is tried with encounters the bug. For instance, let’s say that a function fails when given a prime number but none of the random numbers generated happens to be prime? What does one do in such a case?

It seems to me that it would be nice if it was possible to specify some concrete examples for assert that it would then always try. Something like this:

fc.assert(
  fc.property(fc.tuple(fc.nat(), fc.string()), ...),
  {
    examples: [
      [ 28374, "foobarbaz" ]
    ]
  }
);

The above is just a way to combine the random generated input with some hardcoded input that is known to trigger or have triggered an error.

What do you think about the above? I just ran in to a problem similar to the above. As of right now, I’ve just duplicated the test with the values I know doesn’t work hardcoded into it.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
dubzzzcommented, Jul 18, 2018

The feature of concrete examples has been released with fast-check@1.4.0.

Looking forward for your feedbacks on it.

I will work on improving it by adding shrinker to it later. This feature is really a good idea 😃

0reactions
dubzzzcommented, Oct 14, 2021

@paldepind Next minor release will include shrinking capabilities on examples 🥳

See https://github.com/dubzzz/fast-check/pull/2391

Read more comments on GitHub >

github_iconTop Results From Across the Web

7 Methods for Testing Concrete Strength - For Construction Pros
Methods for Testing Compressive Strength of Concrete · 1. Rebound Hammer or Schmidt Hammer (ASTM C805) · 2. Penetration Resistance Test (ASTM C803)....
Read more >
CONCRETE TESTS - Minnesota Department of Transportation
Slump too high: Add additional cement by full bag to bring the slump ... Start strength tests within 15 minutes of obtaining the...
Read more >
Can someone give a concrete example of a unit test adding ...
My thinking is that adding a unit test for a method that is traversed in an integration test, using the same data as...
Read more >
6 Ways You Know to Test Concrete Strength and 1 You May ...
Review different methods for concrete strength measurement, including concrete maturity. Learn more about onsite and concrete testing labs.
Read more >
The Manual of Aggregate and Concrete Testing “The Gray ...
https://www.globalgilson.com/the-gray-pages-astms-how-to-for- concrete -testingIt's an open secret that one of the most valuable references ...
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