test-check

ben 2019-05-08T11:14:00.018700Z

I have a really basic question: If I want to test multiple assertions in a property test, what is the most idiomatic way to do it? Is it just to wrap each assertion in an all? Or can I leave them as separate forms?

ben 2019-05-08T11:20:33.019200Z

I suppose I could wrap each in a clojure.test/is but that seems definitely wrong

2019-05-08T11:24:36.019600Z

@ben606 are you using defspec?

ben 2019-05-08T12:11:25.019800Z

yes

2019-05-08T12:15:28.020300Z

the main two options are 1) Multiple defspecs 2) an and inside a single defspec

2019-05-08T12:15:38.020500Z

there's tradeoffs

2019-05-08T12:15:55.020900Z

the and could be made nicer if somebody wrote a version of and that returned result-data about which branch failed

ben 2019-05-08T12:23:59.022700Z

Okay, thanks @gfredericks. I guess this isn’t good practice, but I am testing things that depend on each other (db write and read). Seems like the Right Way would be to use multiple defspecs with some additonal setup/teardown?

2019-05-08T22:06:23.023600Z

@ben606 if you're doing something like "generate data, write it to the db, read it back, check that it's equivalent", then you'd want to do all of that in one defspec