Fork me on GitHub
#test-check
<
2020-10-07
>
Hugh Powell22:10:44

Morning folks, does anyone know if there's a simple way to run a `test.check` `defspec` with only the shrunk value of a failed run and without trying to further shrink it? I know I can just call the test itself with a `:seed` argument, but that runs it with the original data and all the subsequent runs to shrink it. This can make debugging harder than it feels it should be. The only way I can think to do this would be to factor out the test code into a function that takes the generated data.

gfredericks22:10:32

This overlaps with the use case of wanting to add regression cases to a defspec. Both of those would not be hard features to implement, just need to decide on an api. But as of now it does not exist. I've done the factoring you describe a number of times, and it fits well with adding a deftest with regression cases.

Hugh Powell22:10:47

Awesome, thanks for that :thumbsup:

👍 1
seancorfield22:10:14

That sounds like the same advice that Eric Normand gives in his Property-Based Testing course (on http://PurelyFunctional.tv).

seancorfield22:10:01

That allows him to take the shrunk failure from the output of defspec and just run that on its own through the test code in a Rich Comment Form in the same ns.