struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hardee, Tony" <Tony.Har...@ps.net>
Subject RE: Interface testing
Date Wed, 07 Mar 2001 20:10:05 GMT
I have a SuccessAction which is just an simple action that forwards to
success.  To test a JSP with the request first flowing through the
ActionServlet you need only specify a mapping for the JSP to test in the
struts-config.xml file.  In the mapping specify SuccessAction as the type
and your jsp as the success forward.  You can define any path that you want.
You still might need to create an associated ActionForm, however creating a
stub ActionForm to test your JSP is fairly trivial.

To test the back-end without having a JSP, I have defined a Snoop.JSP that
works with a Snooper class.  I have overridden the ActionServlet (i.e., the
processActionForward) method to redirect any forwards to *.jsp to Snoop.jsp
if the request has a http request parameter 'snoop'.  Snoop.jsp with the
assistance of the Snooper class uses java introspection to dump the contents
of the session and request contents.  This allows the Action (i.e.,
controller/model) to be developed independently of the view (i.e., JSP).

-----Original Message-----
From: Zach Thompson [mailto:zach@mthoodmedia.com]
Sent: Wednesday, March 07, 2001 1:34 PM
To: struts-user@jakarta.apache.org
Subject: Re: Interface testing


Thanks - I think JUnit will help a lot to improve my development process.

I'm still interesting in hearing about techniques people use to separate
the design of the UI (jsp pages) from the backend implementation 
(Action classes).  Currently, I have to write ActionForm's and Action's 
so the jsp pages don't get exceptions.  I'd like to be able to decouple
these two separate phases of development as much as possible...

Zach

Michael Kelly wrote:
> I've been using JUnit to test the form and action objects (which required
> creating response, request, and servlet stubs for the perform method of
> the action object).  Then I use HTTPUnit for the interface testing.
> 
> -=michael=-
> 
> ======================================================================
>  Michael S. Kelly                           ____       _
>  Axian, Inc.                                 // |_  __(_) ___  _ __
>  4800 SW Griffith Dr., Ste. 202             //| |\\/ /| |/ _ \| '_ \
>  Beaverton, OR  97005 USA             _____//_| | / / | | |_| | | | |
>  Voice: (503)644-6106 x122           ((   //  |_|/_/\\|_|\_/|_|_| |_|
>  Fax:   (503)643-8425                 ``-''          ``-''
>  http://www.axian.com/               Software Consulting and Training
>  mailto:michaelk@axian.com
>  Axian mailto:info@axian.com
> ======================================================================
> 
> On Sun, 4 Mar 2001, Zach Thompson wrote:
> 
> > Hello,
> > 
> > Does anyone have suggestions about how to test the user interface of
> > a Struts application before the backend (Action and ActionForm)'s have
been
> > implemented?
> > 
> > I'm having trouble separating development of the UI from the backend.
It
> > seems like we spend too much time going back and forth trying to get the

> > jsp and all the Struts tags to interact well with the Action's.
Sometimes
> > the UI is unstable or untestable until something on the backend is
fixed.  I
> > think my development process is broken...
> > 
> > xmlc from Enhydra (enhydra.org) was one approach I looked at, and I like

> > the concept of mocking up the entire site up in html before code is
> > written.  We have found that use tests can lead to major re-designs of
> > the backend (especially when the use tests are conducted by clients).
> > Ideally, I'd have the UI and the backend be two separate, independently
> > functioning units that can implemented and tested at different times by
> > different groups and plugged together.
> > 
> > Do I need to create Action and ActionForm stubs to use for testing?  Is 
> > there something that could be integrated into Struts to help with this?
> > Maybe have a setting in struts-config.xml that allows jsp's to run even
> > if there are errors in Struts tags (beans not found, etc.)?
> > Or, am I just going about this all wrong?
> > 
> > Thanks so much,
> > 
> > Zach
> > 
> 

Mime
View raw message