Liking cljdoc? Tell your friends :D

kaocha.repl

REPL interface to Kaocha

Running tests

To run tests from the REPL, use run-tests. Without any arguments it runs all tests in the current namespace. This is equivalent to (run-tests *ns*)

(use 'kaocha.repl)

(run-tests) ;;=> #:kaocha.result{:count 18, :pass 50, :error 0, :fail 0}

Pass one or more arguments to run-tests to only run specific tests. This way you can test a single var, a namespace, or a test suite. You can using keywords, symbols, namespace objects, and vars.

(run-tests :unit)                               ;; run the :unit test suite
(run-tests 'kaocha.random-test)                 ;; run all tests in the kaocha.random-test namespace
(run-tests 'kaocha.random-test/rand-ints-test)  ;; run the specified test
(run-tests #'rand-ints-test)                    ;; test the given var

You can pass in any number of things to test. As a final argument you can pass in a map to override specific configuration options. See config for syntax.

(run-tests :foo.bar
           :bar.baz
           {:config-file "my_tests.edn"
            :focus-meta [:xxx]}) ;; run all tests with ^:xxx metadata

run-tests always performs a full kaocha run, meaning all fixtures, plugins etc will run.

Note that deftest returns the var it defines. This means that with in-buffer evaluation you can use this pattern to quickly define and validate a test.

(run-tests
  (defmethod my-test ,,,))
;;=> #:kaocha/result{:count 1, :pass 3, :error 0, :fail 0}

To run all tests defined in `tests.edn`, use [[run-all-tests]]

## Inspecting configuration and test plan

Before running tests Kaocha builds up a configuration, and based on that loads
all tests and builds up a test-plan. If Kaocha is not behaving as you would
expect then inspecting the configuration and test-plan is a good way to figure
out what's going on. The [[config]] and [[test-plan]] functions provide this
kind of debugging information.

These will particularly come in handy when developing plugins.
REPL interface to Kaocha

## Running tests

To run tests from the REPL, use [[run-tests]]. Without any arguments it runs all
tests in the current namespace. This is equivalent to `(run-tests *ns*)`

``` clojure
(use 'kaocha.repl)

(run-tests) ;;=> #:kaocha.result{:count 18, :pass 50, :error 0, :fail 0}
```

Pass one or more arguments to [[run-tests]] to only run specific tests. This way
you can test a single var, a namespace, or a test suite. You can using keywords,
symbols, namespace objects, and vars.

``` clojure
(run-tests :unit)                               ;; run the :unit test suite
(run-tests 'kaocha.random-test)                 ;; run all tests in the kaocha.random-test namespace
(run-tests 'kaocha.random-test/rand-ints-test)  ;; run the specified test
(run-tests #'rand-ints-test)                    ;; test the given var
```

You can pass in any number of things to test. As a final argument you can pass
in a map to override specific configuration options. See [[config]] for syntax.

``` clojure
(run-tests :foo.bar
           :bar.baz
           {:config-file "my_tests.edn"
            :focus-meta [:xxx]}) ;; run all tests with ^:xxx metadata
```

`run-tests` always performs a full kaocha run, meaning all fixtures, plugins etc
will run.

Note that `deftest` returns the var it defines. This means that with in-buffer
evaluation you can use this pattern to quickly define and validate a test.

``` clojure
(run-tests
  (defmethod my-test ,,,))
;;=> #:kaocha/result{:count 1, :pass 3, :error 0, :fail 0}

To run all tests defined in `tests.edn`, use [[run-all-tests]]

## Inspecting configuration and test plan

Before running tests Kaocha builds up a configuration, and based on that loads
all tests and builds up a test-plan. If Kaocha is not behaving as you would
expect then inspecting the configuration and test-plan is a good way to figure
out what's going on. The [[config]] and [[test-plan]] functions provide this
kind of debugging information.

These will particularly come in handy when developing plugins.
raw docstring

configclj

(config)
(config extra-config)

Load the Kaocha configuration

Optionally takes a map of extra configuration options. These can either use their full form (:kaocha.filter/focus), or the shortened form that is also available through the #kaocha/v1 reader literal. See the Configuration chapter in the docs for more information.

By default this uses tests.edn found in the project root. You can specify an alternative configuration file to use with :config-file.

Load the Kaocha configuration

Optionally takes a map of extra configuration options. These can either use
their full form (`:kaocha.filter/focus`), or the shortened form that is also
available through the `#kaocha/v1` reader literal. See the Configuration
chapter in the docs for more information.

By default this uses `tests.edn` found in the project root. You can specify an
alternative configuration file to use with `:config-file`.
sourceraw docstring

run-all-testsclj

(run-all-tests)
(run-all-tests extra-opts)

Do a full Kaocha test run

Run all tests as specified in tests.edn. Optionally takes a flag of extra configuration options, see config for details.

Do a full Kaocha test run

Run all tests as specified in `tests.edn`. Optionally takes a flag of extra
configuration options, see [[config]] for details.
sourceraw docstring

run-testsclj

(run-tests)
(run-tests & args)

Run tests, returning a summary

Arguments are things to test, any testable id can be specified, including test suite ids, namespace names, and fully qualified var names. Namespace and var objects can also be passed in directly.

With zero arguments it tests the current *ns*.

If the final argument is a map then it is used to build up the test configuration, see config.

This runs through a full Kaocha test run, so all fixtures and plugins are invoked, even when running a single test. Any active reporters will generate their output on stdout.

Returns a summary map:

(run-tests) ;;=> #:kaocha.result{:count 18, :pass 50, :error 0, :fail 0}
Run tests, returning a summary

Arguments are things to test, any testable id can be specified, including test
suite ids, namespace names, and fully qualified var names. Namespace and var
objects can also be passed in directly.

With zero arguments it tests the current `*ns*`.

If the final argument is a map then it is used to build up the test
configuration, see [[config]].

This runs through a full Kaocha test run, so all fixtures and plugins are
invoked, even when running a single test. Any active reporters will generate
their output on stdout.

Returns a summary map:

``` clojure
(run-tests) ;;=> #:kaocha.result{:count 18, :pass 50, :error 0, :fail 0}
```
sourceraw docstring

test-planclj

(test-plan)
(test-plan extra-config)

Load tests and return the test plan

This loads the configuration as per config, then goes through Kaocha's load step and returns the test plan.

Load tests and return the test plan

This loads the configuration as per [[config]], then goes through Kaocha's
load step and returns the test plan.
sourceraw docstring

TestableIdcljprotocol

testable-idclj

(testable-id x)
source

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close