- with-test-server server-thunk tests-thunkprocedure
Start the server by executing server-thunk, run the tests (tests-thunk) and stop the server.
Here's a usage example with the awful, test and http-client eggs:
The awful application to be tested:
(use awful) (define-page "/foo" (lambda () "foo") no-template: #t)
The test program:
(use server-test awful http-client test) ;; The awful application to be tested (awful-apps (list "foo.scm")) (with-test-server (lambda () (awful-start (lambda () (load-apps (awful-apps))))) (lambda () (test "foo" (with-input-from-request "http://localhost:8080/foo" #f read-string))))