This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-05-04
Channels
- # announcements (1)
- # architecture (7)
- # beginners (44)
- # biff (11)
- # calva (15)
- # cider (5)
- # clerk (9)
- # clj-kondo (20)
- # clj-on-windows (19)
- # clj-yaml (2)
- # cljs-dev (39)
- # clojure (52)
- # clojure-czech (2)
- # clojure-dev (11)
- # clojure-europe (28)
- # clojure-hamburg (10)
- # clojure-hungary (3)
- # clojure-nl (1)
- # clojure-norway (59)
- # clojure-uk (5)
- # clojured (2)
- # clojurescript (33)
- # conjure (2)
- # datahike (1)
- # datomic (5)
- # defnpodcast (5)
- # emacs (18)
- # figwheel (2)
- # funcool (6)
- # graphql (1)
- # hyperfiddle (11)
- # jobs (3)
- # joyride (13)
- # malli (6)
- # music (4)
- # off-topic (45)
- # polylith (11)
- # practicalli (3)
- # rdf (3)
- # releases (1)
- # scittle (8)
- # shadow-cljs (13)
- # specter (2)
- # squint (8)
- # testing (6)
- # tools-deps (21)
- # xtdb (2)
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.
This sounds like prime territory for test.check
...?
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
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.
It may not be appropriate for your case -- but it sounds likely, given your description...
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"