Common Lisp Package: CLACK.TEST

# Clack.Test - Testing Clack Applications. ## SYNOPSIS (defpackage clack-test.sample (:use :cl :clack.test :cl-test-more :drakma)) (in-package :clack-test.sample) (test-app (lambda (env) (declare (ignore env)) `(200 (:content-type "text/plain") ("Hello, Clack!"))) (lambda () (multiple-value-bind (body status headers) (http-request "http://localhost:4242") (is status 200) (is body "Hello, Clack!") (is (assoc :content-type headers) "text/plain"))) "Testing simple application") ## DESCRIPTION Clack.Test provides simple interface to test Clack Application or Middleware. Your Lisp have to support multi-thread to run this. ## AUTHOR Eitarow Fukamachi (e.arrows@gmail.com) ## SEE ALSO * [CL-TEST-MORE](https://github.com/fukamachi/cl-test-more) * Drakma

README:

FUNCTION

Public

TEST-APP (APP CLIENT &OPTIONAL DESC)

Test Clack Application.

Private

FIND-HANDLER (SERVER &KEY (FORCE T))

Return a handler package. `server` must be a symbol or a keyword, not containing "Clack.Handler." as a prefix. Example: (find-handler :hunchentoot)

Undocumented

DIAG (DESC)

MACRO

Public

DEFINE-APP-TEST (DESC APP CLIENT &OPTIONAL (ENABLE-DEBUG-P *ENABLE-DEBUG-P*))

Define tests for Clack Application. This just wrap `cl-test-more:deftest', so you can run this test by calling `(cl-test-more:run-test :foo)'.

Private

Undocumented

DEFTEST (NAME &REST TEST-FORMS)

VARIABLE

Public

*CLACK-TEST-HANDLER*

Backend Handler to run tests on. String or Symbol are allowed.

*CLACK-TEST-PORT*

HTTP port number of Handler.

Undocumented

*ENABLE-DEBUG-P*