Lets imagine that I have one servlet that performs an HTTP redirect to a JSP page (or to another servlet). How do I test it with Cactus?
Short answer: you don’t ! Long answer: Cactus is meant to be a unit testing tool, meaning it lets you perform tests for a given method and then it lets you assert the result from that method. In the above scenario, a typical Cactus test will consist in verifying that the return HTTP response is an HTTP redirect (by checking the HTTP response code – 302 – in the endXXX() method) and possibly also checking the URL of the redirect page. Then, as a second test, you could (if you wish) verify that calling the URL of the JSP does return such HTML content (using HttpUnit integration for example). Note that this second test is rather a functional test than a unit test but it can still be viewed as unit testing the doGet() method of the JSP …