Thomas,

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();
  Servlet1.methodToTest();
}

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

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.

Thanks
-Vincent

> -----Original Message-----
> From: Thomas Kettenbach [mailto:[EMAIL PROTECTED]]
> Sent: 17 December 2001 10:30
> To: [EMAIL PROTECTED]
> Subject: Testing servlet chains
> 
> Hi,
> 
> i read in a response to this list, that every test case is a unique
one,
> 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-
> [EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:cactus-user-
> [EMAIL PROTECTED]>
> 




--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to