I have traditionally used the same folder structure for production and test code as demonstrated below:
src/myproject/core.clj
test/myproject/core_test.clj
For test files I have added _test
in the filename.
I recently noticed that several projects follow this structure (this is also what Leiningen generates by default):
src/myproject/core.clj
test/myproject/test/core.clj
Is there a convention regarding this or some clear advantage of using one over the other?
I believe this is just convention - I don't think there is any technical advantage either way.
I personally prefer the first version for entirely non-technical reasons:
full_system_test.clj
for end-to-end testing*_test.clj
filesAlso worth noting that the Maven standard directory layout convention is also used in quite a few Clojure projects (this can be handy if you build polyglot projects that also contain Java source code):
src/main/clojure/myproject/core.clj
src/test/clojure/myproject/core_test.clj
src/main/resources/....
src/test/resources/....
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With