Often you will want to skip certain tests, so they don't get run, or you want to focus on specific tests, so only those get run.
For example:
You can skip tests, or focus on tests, either based on the test ID, or on test or namespace metadata, based on four command line flags and configuration keys.
--skip SYM Skip tests with this ID and their children.
--focus SYM Only run this test, skip others.
--skip-meta SYM Skip tests where this metadata key is truthy.
--focus-meta SYM Only run tests where this metadata key is truthy.
#kaocha/v1
{:tests [{:id :unit
:skip [...]
:focus [...]
:skip-meta [...]
:focus-meta [...]}]}
A test id is a namespaced symbol, for clojure.test tests this is the fully qualified name of the test var. You can skip or focus on such a test either by providing its full name, or just the namespace part.
So you can run a single test with
bin/kaocha --focus com.my.project-test/foo-test
To run all tests in that namespace, use
bin/kaocha --focus com.my.project-test
Suppose you have test that are checked into source code, but that still need work. You can mark these with a metadata tag:
(deftest ^:pending my-test
,,,)
To ignore such tests, add a :skip-meta
key to the test suite config:
#kaocha/v1 {:tests [{:id :unit
:skip-meta [:pending]}]}
This also works for metadata placed on the test's namespace.
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close