testing

respatialized 2023-05-04T14:25:30.936949Z

How do people handle approaches to testing when your assertions start to get into the n >= 100,000 range? I have some tests that aren't particularly expensive to run, so I run them across a huge range of inputs to make sure the property holds over a realistic volume and variety of data, but naively wrapping each property check in clojure.test/is is pretty slow and makes my editor fall over when I try to run the tests from it. It seems like I should probably just aggregate over the sequence of inputs I want to test and use an "expected true count" vs "actual true count" - but I'd still like to narrow in on the failing inputs more easily. Wondering what people do for tests like this.

seancorfield 2023-05-04T17:26:20.562569Z

This sounds like prime territory for test.check...?

respatialized 2023-05-04T17:31:45.592359Z

I'm not using generators to produce inputs for these tests, which I think is the assumption made by prop/for-all - these are tests that use a lot of real data and verify properties of that data after transforming it. https://clojure.github.io/test.check/clojure.test.check.properties.html

seancorfield 2023-05-04T17:57:45.050899Z

Right, I was suggesting switching from example-based tests to generative tests. It's fine to have a few boundary cases expressed as examples, but if you're trying to deal with large numbers of assertions across large numbers of inputs, I would definitely want to use property-based (generative) testing for that.

seancorfield 2023-05-04T17:58:38.045839Z

It may not be appropriate for your case -- but it sounds likely, given your description...

respatialized 2023-05-04T18:26:51.667969Z

This is a context where "exactly right across all known inputs" is the kind of guarantee I need to offer rather than "doesn't fail on large numbers of randomly selected inputs"

👍🏻 1