test-check

Hugh Powell 2020-10-07T22:24:44.026300Z

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.

2020-10-07T22:29:32.029Z

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 Powell 2020-10-07T22:33:47.029500Z

Awesome, thanks for that :thumbsup:

👍 1
seancorfield 2020-10-07T22:57:14.030300Z

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

seancorfield 2020-10-07T22:58:01.031200Z

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.