jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Lybarger <marklybar...@wideopenwest.com>
Subject Re: unit testing a webapp that requires prior logging in
Date Sat, 27 Dec 2003 04:39:03 GMT
James,

Cactus is a testing framework for testing j2ee components servlet, ejb 
and jsp (pseudo servlet). It's strength is that it provides integration 
testing where the tests run in the container, and your j2ee component 
recieves all the services that the container provides. 

James Black wrote:

>Hello,
>
>  I am starting to work with cactus, as I have an application to unit test
>that has various jsp pages and java classes in the classes directory.
>
> 
>
>  In order to do the tests the program needs to be logged into the
>application framework first, and that causes me some difficulty.
>
>  I know how to log in using httpunit, but I don't know how to use that
>WebConversation instance for the rest of the unit test.
>  
>
HttpUnit is a great developer oriented unit testing framework for 
testing application use case scenerios.  IIRC, this is typically called 
black box testing, and generally provides the greatest "bang for your 
buck" with respect to one test per lines of code tested.

> 
>
>  How do I approach this?  I hope my question makes sense.
>
> 
>
>  Also, how do I integrate in the strutsunittest framework with cactus, or
>do I need to use different frameworks for the different parts? It would seem
>that I use httpunit to test the browser side, strutsunit for all of the
>forms and cactus to test the parts that are called by the struts action
>controller.
>  
>
In this instance, struts is the servlet and would be the object being 
tested.  I haven't used the struts framework and am not familiar with 
the strutsunit testing framwork.  I have used turbine, and we found 
HttpUnit to be much easier to test our action classes as well as our web 
interface.  We also used a mock object implementation for testing our 
turbine actions (which contained way too much business logic), but the 
mock object approach we used seemed to be way too much overkill.

> 
>
>  Thank you for your response.
>
> 
>
>"If a man does not keep pace with his companions, perhaps it is because he
>hears a different drummer.  Let him step to the music which he hears,
>however measured and far away." - Henry David Thoreau 
>
> 
>
>
>  
>



Mime
View raw message