You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "McRobb, John" <Jo...@tescopf.com> on 2003/04/02 11:41:32 UTC

FW: Unit Testing

> There are many test tools to stuff:
> 
> struts Test
> Cactus
> HttpUnit
> 
> but none of them seem to do what I want.
> 
> I want to set up a test to load the request with data to test that my page
> renders ok, just now I am using a scriptlet in the jsp.
> Is there any way I can move this out to a class which launches the JSp in
> a bowser with the data on the request.
> 
> Ta
> 
> John
> 
> 


Tesco Personal Finance Limited is a joint venture between The Royal Bank of Scotland plc and Tesco PLC. Tesco Personal Finance Limited is registered in Scotland No 173199. Registered Office: 42 St Andrew Square, Edinburgh EH2 2YE. 

This e-mail message is confidential and for use by the addressee only. If you are not the addressee, please return the message to the sender by replying to it and then delete the message from your computer. 

Internet e-mails are not necessarily secure. Tesco Personal Finance Limited does not accept responsibility for changes made to this message after it was sent.


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: FW: Unit Testing

Posted by James Mitchell <jm...@apache.org>.
On Wed, 2003-04-02 at 04:41, McRobb, John wrote:
> > There are many test tools to stuff:
> > 
> > struts Test
> > Cactus
> > HttpUnit
> > 
> > but none of them seem to do what I want.
> > 
> > I want to set up a test to load the request with data to test that my page
> > renders ok, just now I am using a scriptlet in the jsp.
> > Is there any way I can move this out to a class which launches the JSp in
> > a bowser with the data on the request.

While not *actually* launching a browser, the Cactus testing framework
(w/ HTTPUnit) allows you to test your JSPs as if they were rendered on a
browser.  It actually goes a few steps beyond just calling a JSP,
because in the beginXXX method you can setup the request (adding
cookies, headers, etc), then in the testXXX method, you can forward to
your JSP, then in endXXX you can get the results of the rendered JSP as
a WebResponse.

I've used a few variations of these methods to write the cactus tests
for the core taglibs (although not finished yet).

Check out the source distribution to see examples of how I've setup
testing for the taglibs.  


> > 
> > Ta
> > 
> > John
> > 
> > 
> 
> 
> Tesco Personal Finance Limited is a joint venture between The Royal Bank of Scotland plc and Tesco PLC. Tesco Personal Finance Limited is registered in Scotland No 173199. Registered Office: 42 St Andrew Square, Edinburgh EH2 2YE. 
> 
> This e-mail message is confidential and for use by the addressee only. If you are not the addressee, please return the message to the sender by replying to it and then delete the message from your computer. 
> 
> Internet e-mails are not necessarily secure. Tesco Personal Finance Limited does not accept responsibility for changes made to this message after it was sent.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
-- 
James Mitchell
Software Developer/Struts Evangelist
http://www.open-tools.org




---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org