----- Original Message -----
From: "Peter Donald" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, May 13, 2001 2:54 AM
Subject: Re: Mock Objects vs In-Container/Cactus


> Hi,
>
> At 01:21  12/5/01 +0100, Vincent Massol wrote:
> >It is available on the Cactus web site at :
> >http://jakarta.apache.org/commons/cactus/mockobjects.html
> >
> >I would very much like to have your opinion on that subject. If I receive
a
> >lot of positive answers, it might mean that we'll change the way Cactus
work
> >in order to do it the Mock Object way. As this is a big change, I'd like
to
> >have your opinion on that.
>
> Sorry I don't know enough about Cactus to have an opinion on that but I
> have found Mock Objects useful in the past - for somethings. (Though I
> never used the term MockObject).
>
> The only problem I founf that is overtime you can end up creating a
virtual
> container. With one of my projects I found that my "Mock Container" ended
> up being just a lightweight container - way beyond what it should have
been
> doing.
>

I tend to agree on one point :

* It may not be possible to create a generic mock servlet implementation.
Containers all have slightly different behaviors (cookies handling, ...).
This is even more true if you take the exemple of EJB containers, on how
they handle transactions states  ... The risk is : if we have a too generic
mock implementation, the tests will pass but the component will not run in
the chosen container. On the other and, creating mock implementation of
several containers is too much work ... However, one good point is that if
you use a generic mock impl., the tests pass and the code does not run
correctly in the container, it probably measn that you are using some part
of the specification that is not very standardized. So, you'll know it and
you may want to implement your code otherwise in order to be more
"compatible" ... Also, you msut also have some functional test to ensure
your code will work correctly in the container.

> Cheers,
>
> Pete
>
Cheers,
Vincent

Reply via email to