jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vincent Massol" <vmas...@octo.com>
Subject RE: Testing servlet chains
Date Mon, 17 Dec 2001 10:44:45 GMT

Yes, each test case must be independent one from another. This is seen
from the client point of view. However, on the server side, there is no
issue having a servlet that calls another.

Imagine the following scenario :

public void testXXX()
  MyServlet1 servlet1 = new MyServlet1();

And MyServlet1.methodToTest() calls another servlet/JSP/... by doing a

This works fine.

Now, if instead of doing a forward, you're doing a redirect, the
response will be sent back to the client side and the result you'll get
in endXXX() is the redirect response, not the end response. Why ?
Because the goal of Cactus is not to do end to end functional tests but
rather unit tests. For functional tests, you could do that with HttpUnit
for example.

Note: Internally, this is because Cactus set the "do not redirect" flag
on the HttpURLConnection it uses to connect to the server side.
Providing a way for the user to override this would be possible.
However, I believe it would break the focus of Cactus on unit tests. If
we get enough votes for that, we may add it in future versions.


> -----Original Message-----
> From: Thomas Kettenbach [mailto:kettenbach@prostep.de]
> Sent: 17 December 2001 10:30
> To: cactus-user@jakarta.apache.org
> Subject: Testing servlet chains
> Hi,
> i read in a response to this list, that every test case is a unique
> and you need to maintain a correct environment before each test.
> I have a project were i need to test some servlets which depend
> on each other.
> Can anybody give me some suggestions how i could do that?
> Best regards,
> Thomas
> --
> To unsubscribe, e-mail:   <mailto:cactus-user-
> unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:cactus-user-
> help@jakarta.apache.org>

To unsubscribe, e-mail:   <mailto:cactus-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:cactus-user-help@jakarta.apache.org>

View raw message