The organization is up to you. You can either create a separate directory tree for integration tests, have separate files in the same directory tree, or run unit tests and integration tests in the same test source files.
The only real difference between unit and integration tests is
- How long do they take to run
- Additional configuration with other components of your system (this also means that they are slower and / or harder to work with).
So, in any case, all integration tests should be tagged with ^:integration metadata for each function. This method is also useful for "slow" unit tests.
A slow test can be labeled like this (which uses clojure.test.check generator testing):
(tst/defspec ^:slow round-trip-bytes 9999 (prop/for-all [orig gen/bytes] (let [string-b64 (b64/encode-bytes->str orig) result (b64/decode-str->bytes string-b64) ] (assert (every? b64/base64-chars (seq string-b64))) (assert (types/byte-array? result)) (= (seq orig) (seq result)))))
Then in project.clj (not loading, I know), specify:
:test-selectors { :default (complement :slow) :slow :slow }
Then, when you say lein run , the tests marked with ^:slow will be skipped, and when you say lein run :all , all tests (including "slow") will be run.
Note that the keyword :slow is nothing special. You can replace any keyword you want, for example :integration .
I did not use boot much, but I assume a similar method is available.
source share