(index ("test-server-port" 0) ("connect-procedure" 158) ("standby-time" 407) ("max-attempts-to-connect" 629) ("time-between-attempts-to-connect" 865) ("with-test-server" 1108) ("start-test-server" 2086) ("stop-server" 2277))
(def (sig (parameter "(test-server-port [integer])" (id test-server-port))) (p "The port to access the test server.  The default value is " (tt "8080") "."))
(def (sig (parameter "(connect-procedure [procedure])" (id connect-procedure))) (p "The procedure to be used to check if the server is ready to accept requests.  Default is " (tt "tcp-connect") " from " (int-link "/man/4/Unit tcp" "unit tcp") "."))
(def (sig (parameter "(standby-time [integer])" (id standby-time))) (p "Time in seconds to wait for the server to start serving after it has started accepting connections.  This parameter was introduced in version 0.4."))
(def (sig (parameter "(max-attempts-to-connect [integer])" (id max-attempts-to-connect))) (p "Maximum number of attempts to connect to the server before assuming that it failed to start. This parameter was introduced in version 0.4."))
(def (sig (parameter "(time-between-attempts-to-connect [integer])" (id time-between-attempts-to-connect))) (p "Time in seconds to wait between to consecutive attempts to connect to the server. This parameter was introduced in version 0.4."))
(def (sig (procedure "(with-test-server server-thunk tests-thunk)" (id with-test-server))) (p "Start the server by executing " (tt "server-thunk") ", run the tests (" (tt "tests-thunk") ") and stop the server.") (p "Here's a usage example with the " (int-link "/egg/awful" "awful") ", " (int-link "/egg/test" "test") " and " (int-link "/egg/http-client" "http-client") " eggs:") (p "The awful application to be tested:") (highlight scheme "(use awful)\n\n(define-page \"/foo\"\n  (lambda ()\n    \"foo\")\n  no-template: #t)") (p "The test program:") (highlight scheme "(use server-test awful http-client test)\n\n;; The awful application to be tested\n(awful-apps (list \"foo.scm\"))\n\n(with-test-server\n (lambda ()\n   (awful-start\n    (lambda ()\n      (load-apps (awful-apps)))))\n (lambda ()   \n   (test \"foo\"\n         (with-input-from-request \"http://localhost:8080/foo\"\n                                  #f\n                                  read-string))))"))
(def (sig (procedure "(start-test-server thunk)" (id start-test-server))) (p "Start the test server and returns its pid.  " (tt "thunk") " is the procedure which actually runs the server."))
(def (sig (procedure "(stop-server pid)" (id stop-server))) (p "Stops the server whose pid is the given " (tt "pid") "."))
