Fork me on GitHub
#kaocha
<
2019-05-02
>
dadair21:05:02

This may be a dumb question, but how are people deciding to split and name their different testing levels? e.g., have a test/unit and test/integration; but if I say unit test foo.bar, I’m going to have test/unit/foo/bar_test.clj, with test-ns foo.bar-test. If I also want to have integration tests, I’m going to have test/integration/foo/bar_test.clj, with test-ns foo.bar-test. I now have two identical namespaces. I want to keep the parity between the src and test namespaces, so stuff like “jump to test file” works. So how is everyone else doing it?

dadair21:05:51

Although I guess after reading it, “jump to test file” wouldn’t work anymore regardless, so that’s a non-issue.

dadair21:05:00

Are people essentially just prefixing the unit. and integration. onto their namespaces?

dadair21:05:25

For a concrete example; unit testing vs real-http-request testing a ring handler and cleanly separating the two

jvtrigueros22:05:18

We're actually grappling with something similar at work, but at a more fundamental level "what is a unit test?", "when is a test considered integration?" etc. At a glance, it seems like pre/postfixing, that's what I'm currently doing with generative tests.

plexus11:05:57

@U0E2EQFME my integration tests generally are organized by the features they test, rather than the namespaces under test. Since they integrate multiple pieces there is no one-to-one mapping between test and namespace there.

rickmoynihan21:05:45

I 100% agree with @U07FP7QJ0 — In my experience you’re much, much better organising applications by vertical features at the top rather than by horizontal concerns. Within a feature you can then split horizontally if you need to. i.e. app.tweet app.profile app.direct-message app.search rather than app.handler app.middleware app.models … Tests then follow a similar structure - though you may have something like app.search.integration