jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vincent Massol" <vmas...@octo.com>
Subject RE: Multi Step Tests - Better HttpUnit Integration
Date Fri, 27 Sep 2002 18:24:14 GMT
Hi Steve,

Have you looked at Mock Objects (http://www.mockobjects.com)? This is
what I use when I need to provide fake objects to replace complex code.

For example, let's imagine that you have a complex object to create that
needs to be present in the HTTP session before the test.

You can easily write a Mock for it (or even better use EasyMock to
automatically generate a mock dynamically) and put the mock in the
session.

What is important to realize is that when you are unit testing a method,
you are really interested in testing this method's code logic and not
other domain object (they will get tested by their own unit tests).

Do you have an example to help us see the issues you are facing?

Thanks
-Vincent

> -----Original Message-----
> From: Steve Appling [mailto:steve100@appling.org]
> Sent: 26 September 2002 17:07
> To: Cactus Users List
> Subject: Re: Multi Step Tests - Better HttpUnit Integration
> 
> What Cactus buys me is the ability to have a test running in the
container
> with an instance of my servlet.  After all of the setup (which is what
I
> am
> using HttpUnit for) I can make asserts about the internal state of my
> Servlet.  I don't have a way of doing this by just looking at the
> servlet's
> response with HttpUnit.
> 
> It may be possible to preset the state of my system before this one
call,
> but it would be extremely complicated.  The particular servlets under
test
> rely on other parts of the web application being set up.  Some of
those
> parts are outside of my control and do not have a convenient mechanism
to
> initialize them to a particular state.  It seems that the most
reliable
> way
> of running my test in the actual context that the code will execute
under
> when in production is to actually generate the required pre-requisite
> requests.
> 
> 
> ----- Original Message -----
> From: "Larry Tambascio" <ltambascio@charter.net>
> To: "Cactus Users List" <cactus-user@jakarta.apache.org>
> Sent: Thursday, September 26, 2002 11:48 AM
> Subject: Re: Multi Step Tests - Better HttpUnit Integration
> 
> 
> > Hi Steve,
> >
> > It sounds to me like what you really need is HttpUnit.
> >  I'm unsure what Cactus is buying you.  What I have
> > usually done is to setup the session as though all your
> > preceding requests and responses have been made.  My guess
> > is that it would take about the same amount of code to
> > setup all the session values as it does to do the HttpUnit
> > web conversation thing.  Finding out what those all are
> > could be tedious, but it would make your tests cleaner and
> > faster, IMHO.
> >
> > -Larry
> 
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:cactus-user-
> unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:cactus-user-
> help@jakarta.apache.org>



--
To unsubscribe, e-mail:   <mailto:cactus-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:cactus-user-help@jakarta.apache.org>


Mime
View raw message