At 06:07 PM 6/29/2001 +0100, Jari Worsley wrote:
>- by making HttpWebResponse public, you can give it nonsense for the
>target and URL (1st and 2nd params), then give it the HttpURLConnection,
>and get back an HttpWebResponse object, allowing calls like getText(),
>getForms(), etc...
Or we can specialize it to make a CactusWebResponse - it would be cleaner
and shouldn't take a lot of work.
>WHY!!!!
>=======
>Now this seems to me a bit too complicated, and there must be a better
>way of doing things.
>
>Cactus is good for testing server side code, but not at testing the
>result that is sent back to the client.
>
>HttpUnit is good at testing the result back at the client, but has no
>facility to set test conditions on the server. so it can only be used
>for a test of the full functionality of a site, rather than for testing
>a site in parts (e.g. testing JSP and Servlet code separately).
And you can also write standalone servlet tests, using the ServletUnit
package - but HttpUnit does not support JSPs or in-container testing.
>Why do i want to do this? because in my organization the authors of
>servlet and JSP code are different people. It would be good to be able
>to test the JSP and Servlets independently of each other, and just
>provide an interface between the two for both groups to program to -
>sort of a "JSP Contract".
>
>It seems to me that a "mating" in some way of HttpUnit and Cactus
>functionality would allow you to perform unit testing of the View part
>of a Model 2 application separately from the Model and Controller part.
>
>
>so, daft idea, or mileage in it? I would still like to know what tools
>and techniques others are using to test just the JSP component of an
>application.
We should talk some more about this. You have identified two specific
useful ways to use the two together. I would be interested more in your
ideas for model 2 testing. The tricky part there of course is that there
is often a fair bit of coupling between the two, but you might be able to
fake out the servlet to test the JSP in Cactus, and I see no reason that
you could not do the same with the servlet, assuming that it is
sufficiently well factored.