testing

zeddan 2022-09-15T08:35:13.578519Z

Interesting 🙂 I like the idea of name tests over concepts, that makes good sense. Regarding the first question, in RSpec you get the structure of describing the tests for free:

describe "when there is one variant" do
 it "creates one variant" do
   expect { ... }
 end
end
Where do you stand on writing testing blocks like this? When there is one variant, it creates one variant or Given there is one variant, it creates one variant. Do you have any other convention och preferred way of writing?

zeddan 2022-09-15T08:36:11.089399Z

Of course this is not the most important aspect in the world, but I would like to introduce a standard to our project so that the tests don’t look so messy

lread 2022-09-15T14:20:28.027279Z

@robin.saaf I kinda sorta took that approach for https://github.com/cljdoc/cljdoc/blob/a33d1eea3bb7cd832f92e84f985f22197a037c54/test/cljdoc/util/fixref_test.clj#L17-L158. Everything has its pros and cons... I like this for this particular test because it helped me to think about variants, and the test output is very descriptive. A downside is that it is a bit harder to extract an individual test in the REPL, especially when the testing blocks depend on some setup in the deftest. I guess also: run order of testing blocks is not randomized.