Test helper functions, including an all clojure mocking facility
Latest commit df78311 Dec 20, 2010 @hugoduncan clean up tabs
Failed to load latest commit information.
src clean up tabs Dec 20, 2010
.gitignore Fixed bug in mock/create-protocol-impl: Dec 20, 2010
README.md Fixed readme namespace usage May 25, 2010
pom.xml Update to clojure 1.2.0 Aug 20, 2010
project.clj Update to clojure 1.2.0 Aug 20, 2010



atticus is a embryonic collection of tools to help testing.

atticus.mock is a slightly different approach to mocking, where the mocked function can be implemented as an inline function to do whatever checking or return value calculation that is required.

;; pull in namespaces
    (use 'clojure.test)
    (require 'atticus.mock)

;; define test which mocks f
(deftest mock-test
        [(f [arg]
           (is (= arg 1) "Check argument")
    (is (= 1 (f 1)) "Call mocked function"))

At the moment there are two macros that can be used to wrap the body of the mocked function and will add verification for the number of times the mocked function is called. The once macro ensures the function is called once, and only once. The times macro, which takes an integer argument, ensures the function is called exactlyt he specified number of times.

;; define test, that should be called just once
(deftest mock-test
        [(f [arg]
             (is (= arg 1) "Check argument")
    (is (= 1 (f 1)) "Call mocked function"))

atticus.utils contains some test helpers for accessing private vars, and for handling temporary files.

API documentation is available.


atticus is distributed as a jar, and is available in the clojars repository.

Installation is with Leiningen, maven, or your favourite maen repository aware build tool.


Licensed under EPL