-
Notifications
You must be signed in to change notification settings - Fork 20
Test Anything Protocol Extensions
Thomas M. Hermann edited this page Feb 11, 2013
·
2 revisions
The Test Anything Protocol extension exports 2 functions,
write-tap
and write-tap-to-file
. These functions write a test
results database using the TAP format.
(write-tap test-results [stream])
write-tap
writes the test-results
using the stream defaulting to
*STANDARD-OUTPUT*
.
(write-tap-to-file test-results path)
write-tap-to-file
writes the test-results
to the path
. The path
is created, if necessary, using ENSURE-DIRECTORIES-EXIST
. The
test-results
are then written to a stream with write-tap
inside of
WITH-OPEN-FILE
.
NOTE: The :SUPERSEDE
option is provided to WITH-OPEN-FILE
, so if
the TAP file exists, it is overwritten.
The following is an example of using the test-run-complete
condition
and ASDF to generate TAP output.
;;; hook test-op to record `lisp-unit` test output as TAP files.
(defmethod asdf:perform :around ((o asdf:test-op) (system asdf:system))
;; Don't debug tests and signal completion
(lisp-unit:use-debugger nil)
(lisp-unit:signal-results)
;; Find a good filename
(handler-bind ((lisp-unit:test-run-complete
(lambda (trc)
(lisp-unit:write-tap-to-file
(lisp-unit:results trc)
(merge-pathnames
(format nil "TAP/~a.tap" (asdf:component-name system))
*tap-output-directory*)))))
(call-next-method)))