test_psgi $app, $client; test_psgi app => $app, client => $client;
For your convenience, the HTTP::Request given to the callback automatically uses the HTTP protocol and the localhost (127.0.0.1 by default), so the following code just works:
would represent a request for a URL that has no scheme, has a hostname foo and a path /bar, instead of a path //foo/bar which you might actually want.
Specify the Plack::Test backend using the environment variable PLACK_TEST_IMPL or $Plack::Test::Impl package variable.
The available values for the backend are:
For instance, test your application with the HTTP::Server::ServerSimple server backend with:
MockHTTP (Default) Creates a PSGI env hash out of HTTP::Request object, runs the PSGI application in-process and returns HTTP::Response. Server Runs one of Plack::Handler backends (Standalone by default) and sends live HTTP requests to test. ExternalServer Runs tests against an external server specified in the PLACK_TEST_EXTERNALSERVER_URI environment variable instead of spawning the application in a server locally.
> env PLACK_TEST_IMPL=Server PLACK_SERVER=HTTP::Server::ServerSimple \ prove -l t/test.t
|perl v5.20.3||PLACK::TEST (3)||2015-06-03|