<p>I have a bunch of servlets running under the Tomcat servlet container. I would like to separate test code from production code, so I considered using a test framework.
JUnit is nicely integrated into Eclipse, but I failed to make it run servlets using a running Tomcat server. Could you please recommend a unit testing framework that supports testing Tomcat servlets? Eclipse integration is nice but not necessary. </p>

Okay.  Ignoring the 'tomcat' bit and coding to the servlet, your best bet is to create mocks for the response and request objects, and then tell it what you expect out of it.
So for a standard empty doPost, and using
EasyMock
, you'll have
```
```
public void testPost() {
   mockRequest = createMock(HttpServletRequest.class);
   mockResponse = createMock(HttpServletResponse.class);
   replay(mockRequest, mockResponse);
   myServlet.doPost(mockRequest, mockResponse);
   verify(mockRequest, mockResponse);
}
```
```
Then start adding code to the doPost.  The mocks will fail because they have no expectations, and then you can set up the expectations from there.
Note that if you want to use EasyMock with classes, you'll have to use the EasyMock class extension library.  But it'll work the same way from then on.