Java Servlet Testing with ServTest
ServTest is a Java Servlet container designed for unit testing
of Servlets. It's based on the principle that one should make the
Servlet tests as independent as possible from all of the other
classes in the system, ideally testing only the Servlets themselves,
without reference to any other classes that they might use. Separating
servlet behaviour and testing from other classes in the system
allows one to:
- more quickly and precisely pinpoint any errors,
- run the tests in less time, and
- avoid complicated and slow testing frameworks needed to
support the testing of other classes in the system.
In particular, making the tests independent of any HTTP and HTML
processing makes the tests faster and more robust in the face of
HTML changes. Making the tests independent of any database
interaction makes the tests faster and avoids many common problems
and false failures related to database configuration and data
loading issues.
Tutorials
The following tutorials need to be written and added:
- A simple servlet, and how we run it in the testing framework.
- Testing output: splitting the controller from the view and
and verifying data before presentation, rather than after.
- Disconnecting from other layers: using test mode and mock
objects to avoid reliance on other parts of the system during
testing.
Author
Curt Sampson, <cjs@cynic.net>.
Copyright
All code and all documentation in this SourceForge project
("servtest") is in the public domain.
Thanks to others who have provided software that makes this project possible: