You may want to try EasyMock instead of these mock servlet api
implementations
http://www.easymock.org/

Once you get your head around how this works, you may not go back to using
concrete
Mock objects again.


-----Original Message-----
From: Joe Germuska [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, November 23, 2004 6:15 AM
To: Martin Cooper; Struts Developers List
Subject: Re: Experiences with MockObjects for Servlet testing?


At 4:44 PM -0800 11/22/04, Martin Cooper wrote:
>On Mon, 22 Nov 2004 16:28:32 -0800, Don Brown <[EMAIL PROTECTED]> wrote:
>>  Perhaps this might be a good time to bring up the idea of bringing  
>> StrutsTestCase as a Struts subproject?  They have an implementation 
>> of  the servlet api for testing.
>
>Also, someone (Howard?) mentioned at ApacheCon that ServletUnit is a 
>good, stable, full-featured framework for testing, well, servlet-based 
>code. I'd like us to take a look at that before we make any hard 
>decisions about testing frameworks.

I thought I knew, but then when I went investigating, I ran into the 
question of just what (or which) is servletunit?

There's a fairly dormant Sourceforge Project: 
http://servletunit.sourceforge.net/ where code is in the package 
com.kizna.servletunit

It's the top-level package for StrutsTestCase: 
http://strutstestcase.sourceforge.net/api/index.html


HTTPUnit has a servletunit package (com.meterware.servletunit): 
http://httpunit.sourceforge.net/doc/api/index.html

I think one (or more) of these might be as good or better as having 
Cactus tests in Struts as a whole -- but I still would prefer to use 
MockObjects for the kind of isolated testing I was trying to do with 
the CreateAction yesterday, so as to minimize the amount of 
extraneous setup required.  That is, I'd prefer to use MockObjects if 
it worked for the test I needed.  I suppose if we were using a mock 
servlet environment, I might be able to use components from it 
without having to simulate an entire Struts installation.  (I see 
that the "ServletContextSimulator" in StrutsTestCase simply returns 
null for an attribute which isn't in the servlet context, which would 
be all I needed...)

Joe

-- 
Joe Germuska            
[EMAIL PROTECTED]  
http://blog.germuska.com
"Narrow minds are weapons made for mass destruction"  -The Ex

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to