Running unit tests in Cider
SPC p a switches between source and test buffers.
, t n run all tests in the current namespace. This also loads any changes to those tests.
, t a run all tests. If tests are changed or added, , e f to evaluate those tests to add them to the REPL or , e b on any test buffers that have changed.
The results of running the tests are displayed in the mini-buffer, showing the number of tests run and how many passed and failed.
Spacemacs loads current buffer before running tests
Run unit tests from the buffer that has changes or new tests. Otherwise, ensure all buffers with changes have been evaluated to ensure the tests run with the right src and test code.
Using Test Selectors to run specific tests
Using the universal argument before calling CIDER test runner will prompt for test selector filters, running only those tests that match the selector inclusions/exclusions.
SPC t a runs all the tests in a project.
SPC u SPC t a prompts for test selectors and runs the matching tests in a project.
SPC t l runs all tests currently evaluated in the REPL.
SPC u SPC t l prompts for test selectors and runs the matching tests currently evaluated in the REPL.
CIDER first prompts for the test selectors to include:
Then prompts for the test selectors to exclude. A warning displays in the power line if CIDER does not find the test selector name.
Running tests in the REPL buffer
, to open the REPL command menu and select run tests
Auto Unit Test Mode
, T t to toggle auto test mode
, e b will evaluate the current buffer and automatically run all tests.
CIDER test report only created on test failure
To show a test report each time tests are run, add the variable
cider-test-show-report-on-success t in the
clojure layer list of the
(clojure :variables cider-test-show-report-on-success t)