Fast and pretty Clojure test runner
Clojure
Latest commit e28a936 Feb 24, 2017 @weavejester Release 0.1.3
Permalink
Failed to load latest commit information.
doc Add screenshots to README Aug 20, 2015
src/eftest Merge pull request #5 from jcf/use-monotonic-clock Feb 24, 2017
.gitignore Initial commit Aug 10, 2015
README.md Release 0.1.3 Feb 24, 2017
project.clj Release 0.1.3 Feb 24, 2017

README.md

Eftest

Eftest is a fast and pretty Clojure test runner.

Installation

To install, add the following to your project :dependencies:

[eftest "0.1.3"]

Screenshots

When all the tests pass, it looks like this:

Passing example

When a test fails, it looks like:

Failing example

And when a test throws an exception, it looks like:

Erroring example

Usage

Eftest has two main functions: find-tests and run-tests.

The find-tests function searches a source, which can be a namespace, directory path, symbol, var, or a collection of any of the previous. It returns a collection of test vars found in the source.

The run-tests function accepts a collection of test vars and runs them, delivering a report on the tests as it goes.

Typically these two functions are used together:

user=> (require '[eftest.runner :refer [find-tests run-tests]])
nil
user=> (run-tests (find-tests "test"))
...

The above example will run all tests found in the "test" directory.

By default Eftest runs tests in parallel, which can cause issues with tests that expect to be single-threaded. To disable this, set the :multithread? option to false:

user=> (run-tests (find-tests "test") {:multithread? false})

Alternatively, you can add the :eftest/synchronized key as metadata to any tests you want to force to be executed in serial:

(deftest ^:eftest/synchronized a-test
  (is (= 1 1)))

You can also change the reporting function used. For example, if you want a colorized reporter but without the progress bar:

user=> (run-tests (find-tests "test") {:report eftest.report.pretty/report})

Or maybe you want the old Clojure test reporter:

user=> (run-tests (find-tests "test") {:report clojure.test/report})

License

Copyright © 2017 James Reeves

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.