[radicalzephyr/boot-junit "0.4.0"] ;; latest releaseBoot task for running jUnit Java tests.
- Provides a
junittask
First, make sure the root of your java sources and test sources are
included in your boot :source-paths:
(set-env!
:source-paths #{"src/main/java" "src/test/java"}
...)If JUnit is not already included as a dependency, you will need to include it. Maven dependency information for JUnit4 can be found here. Then you can do something like this in your build.boot:
(set-env!
...
:dependencies [junit/junit "4.12" :scope "test"]
[radicalzephyr/boot-junit "0.4.0" :scope "test"]
...)To make the junit task available in your Boot task pipeline:
(require '[radicalzephyr.boot-junit :refer (junit)])Optionally, you can configure the junit task with the packages to be
searched for jUnit tests.
(task-options!
junit {:packages #{"radicalzephyr.boot_junit.test"}})If no packages are specified, the task will automatically try to run all tests in packages defined in the current project.
Finally, I typically define a test task for ease of use.
(deftask test
"Compile and run my jUnit tests."
[]
(comp (javac)
(junit)))Now just run boot test!
Copyright © 2015-2018 Geoff Shannon
Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.