Classes for unit testing servlets, providing internal access to running servlets using a simulated servlet container.
See: Description
Interface Summary | |
---|---|
InvocationContext | An interface which represents the invocation of a servlet. |
InvocationContextFactory | An interface for an object which acts as a factory of InvocationContexts |
JSPServletDescriptor | Describes a servlet used to handle JSPs. |
Class Summary | |
---|---|
JUnitServlet | A servlet which can run unit tests inside a servlet context. |
ServletRunner | This class acts as a test environment for servlets. |
ServletRunner.JasperJSPServletDescriptor | |
ServletTestCase |
A base class for test cases to be run via JUnitServlet .
|
ServletUnitClient | A client for use with the servlet runner class, allowing the testing of servlets without an actual servlet container. |
ServletRunner
which will act as a servlet application context.
The definition of application context may be supplied in one of two ways.
The registerServlet
method allows the
association of a servlet with a url path. Alternately, an entire servlet application may be defined by passing the
name of the desired web.xml file.
The newClient
method will return a
ServletUnitClient
object which can be
used to invoke the defined servlets, just as any subclass of
WebClient
. In addition, this client object defines methods which allow
access to the fully initializated servlet itself, as well as the request, response, and servlet session.
A tutorial is available.
Please direct any questions to Russell Gold.