Some useful user comment is linked from the project home page.
has the usual features you would expect from an xUnit style test framework [...] presents a more lispish macro interface.
Download ASDF package from http://common-lisp.net/project/bese/tarballs/fiveam-latest.tar.gz
Example:
CL-USER> (def-suite my-suite :description "My Example Suite")
CL-USER> (in-suite my-suite)
CL-USER>
(test my-tests
"Example"
(is (= 4 (+ 2 2)) "2 plus 2 wasn't equal to 4 (using #'= to test equality)")
(is (= 0 (+ -1 1)))
(signals
(error "Trying to add 4 to FOO didn't signal an error")
(+ 'foo 4))
(is (= 0 (+ 1 1)) "this should have failed"))
CL-USER> (run!)
...f
Did 4 checks.
Pass: 3 (75%)
Skip: 0 ( 0%)
Fail: 1 (25%)
Failure Details:
--------------------------------
MY-TESTS [Example]:
this should have failed.
--------------------------------
I'm pretty new at lisp, but I found the def-fixtures in 5am triggered the following: :Redefining CL-USER::A-FIXTURE in deflookup-table named IT.BESE.FIVEAM::FIXTURE
The reason for this is the following EVAL-WHEN in DEF-FIXTURE (fixture.lisp):
`(eval-when (:compile-toplevel :load-toplevel :execute)
(setf (get-fixture ',name) (cons ',args ',body))
',name))
I changed it to the following to get SBCL to load without warnings. All that is done is removing the fixture before generating the new one. I got the idea from the null def-fixture in the test cases in 5am's repository.
;;; Modified from http://common-lisp.net/project/bese/repos/fiveam/src/fixture.lisp (defmacro def-fixture (name args &body body) "Defines a fixture named NAME. A fixture is very much like a macro but is used only for simple templating. A fixture created with DEF-FIXTURE is a macro which can use the special macrolet &BODY to specify where the body should go.-- NixeagleSee Also: WITH-FIXTURE
*note* that this overrides the default 5am DEF-FIXTURE. 5am's DEF-FIXTURE does not remove the old instance of the fixture." `(eval-when (:compile-toplevel :load-toplevel :execute) (rem-fixture ',name) (setf (get-fixture ',name) (cons ',args ',body)) ',name))
;;; Fixtures get used like this: (def-fixture test/fixture (&optional (a 1) (b 2)) (&body))
(5am:with-fixture test/fixture () (list a b))
;;This is kind of neat in a way, as if one of the defaults in ;;the fixture is off, you only need to define that one. Any ;;valid lambda list can be passed as it is processed by ;;destructing bind.
;;A real test using our fixture looks something like: (test (fixture-test1 :fixture test/fixture) (is (= a 1)) ; passes (is (= b 2))) ; passes
;;If we wanted to override the value of a, but leave b ;;(and potentially many more) alone do the following: (test (fixture-test2 :fixture (test/fixture 7)) (is (= a 7)) ; passes (is (= b 2))) ; passes
This page is linked from: 5am armish liards Marco Baringer test framework
CLiki pages can be edited by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively