I totally agree with this approach. Here is how I abstract Struts away from http:
http://www.mail-archive.com/[email protected]/msg40143.html This way, I can test as close to the protocol as possible, allowing me to remove the protocol-specific issues. Then if a bug comes up, I can determine if its in the JSP/field bindings/HTML, the action logic, or the business tier using my various tests to quickly narrow down the issue. You can then supplement with in-container testing as desired. James > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > Sent: Thursday, September 26, 2002 9:47 AM > To: Struts Users Mailing List > Subject: Re: Unit testing a struts application > > > > > Also for unit testing actions out-of-container, take a look > at StrutsTestCase : http://strutstestcase.sourceforge.net/. > > One approach that is also commendable for unit testing - > regardless of servlet framework used - is to keep as much > code as possible out of container-dependent objects. For > instance, if you can have a Struts Action class delegate work > to a regular java object with non-container parameters > passed, rather than doing that work in the action itself, > than the code that does the work can be more easily tested > with vanilla Junit. > > For in-container testing, which we have used a lot for > acceptance tests as opposed to unit tests, Cactus as > recommended by Jim comes up a lot. We use > HttpUnit: http://httpunit.sourceforge.net/. We also ended up > wrapping HttpUnit with a somewhat simpler API that is on > sourceforge as well: http://jwebunit.sourceforge.net/. > > Jim Weaver > Software Developer - ThoughtWorks > > > > > > "Jim Young" > > <northernobjects@h To: > [EMAIL PROTECTED] > otmail.com> cc: > > Subject: Re: > Unit testing a struts application > 09/26/2002 06:28 > > AM > > Please respond to > > "Struts Users > > Mailing List" > > > > > > > > > > Cactus works great with Struts. Just go to there web page > http://jakarta.apache.org/cactus/index.html and check out the > documentation > > & examples. Join their user list, check the archives and if > you still have questions ask the Cactus user group. You will > also need to know all about JUnit - http://junit.org/index.htm > > Jim > > >From: "Daniel H. F. e Silva" <[EMAIL PROTECTED]> > >Reply-To: "Struts Users Mailing List" > <[EMAIL PROTECTED]> > >To: [EMAIL PROTECTED] > >Subject: Unit testing a struts application > >Date: Thu, 26 Sep 2002 06:14:13 -0700 (PDT) > > > >Hi all, > > I am searching for possible improvements on my development > process. > >One of greatest things i've found is XP. I liked it very much. > > One of XP rules is about unit testing. So follows my > question : How can > i > >unit test a struts app? > >I heard about Cactus (another Jakarta project). Does someone > here have > >experience using it? All kind of use cases would be a plus. > > > >Best regards, > > Daniel. > > > > > >__________________________________________________ > >Do you Yahoo!? > >New DSL Internet Access from SBC & Yahoo! > >http://sbc.yahoo.com > > > >-- > >To unsubscribe, e-mail: > ><mailto:[EMAIL PROTECTED]> > >For additional commands, e-mail: > ><mailto:[EMAIL PROTECTED]> > > > > > Jim Young > Northern Objects Inc. > 905 781-7019 > > > _________________________________________________________________ > Chat with friends online, try MSN Messenger: http://messenger.msn.com > > > -- > To unsubscribe, e-mail: < > mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: < > mailto:[EMAIL PROTECTED]> > > > > > > > > -- > To > unsubscribe, e-mail: > <mailto:struts-user-> [EMAIL PROTECTED]> > For > additional commands, > e-mail: <mailto:[EMAIL PROTECTED]> > > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

