Generative testing for JavaScript
github.com
github.com
On the other hand, the fact that it would fail at all would help you see that you have a bug. Something you might not have caught before.
The workflow for using them is very different. A unit test suite contains a finite number of assertions and, assuming no bugs, should run in a relatively small (or at least bounded) amount of time. A generative test, however, usually can run forever _by design_.
A typical workflow is to start a run overnight and see if it caught anything in the morning. If the generative suite finds any bugs, you turn the specific cases that caused the failures into unit tests and commit them.
[1]: http://www.cse.chalmers.se/~rjmh/QuickCheck/manual.html
Fuzzing is more crude in that it doesn't really know what happens after providing the random value, it just tries to crash or fail asserts.
generative testing involves writing an invariant, in the test itself, that holds over the random values.
here are some examples of properties or invariants http://fsharpforfunandprofit.com/posts/property-based-testin...
Of course, if you discover a test failure on a very low-probability corner case, other people working on their own branches probably won't trigger it. But with the right workflow, the situation shouldn't be all that different from adding a regular test case, which could always fail once attempt you merge it with someone else's code that wasn't written against it.
Avoid calling Math.random in your [custom generator] functions, since if you do so, test runs won't be repeatable. All randomness should come from the built-in generators.
A failing test should be straightforward to turn into a simple checked example - most good libraries have extensive simplification steps that try and boil failing examples down to the minimal example that still causes the test to fail.
But this is only necessary if repeated runs of the property based tests don't reproduce a failure*. For me, they have.