incubator-adffaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adam Winer" <awi...@gmail.com>
Subject Re: Thoughts about unit testing and mock objects
Date Thu, 11 May 2006 00:43:29 GMT
JMock does look interesting, but a couple of basic questions:
 - Is it available in a maven repository?
 - Is its license compatible?

... and one more general one.  The thing that drives me up the
wall with the current mock codebase in the ADF Faces tests
is that it forces you to say "I expect method foo() to be called
at least N times", even though with JSF there's rarely any
such assurances whether a method will be called or not,
and if so how many times.   E.g., how often is FacesContext.getViewRoot()
called?  Once?  Twice?  20 times?

This leads to extremely brittle tests that are a mess to write
and understand.

So, to be more brief:  does JMock fix this awfulness, or perpetuate
it? :)

-- Adam


On 5/10/06, John Fallows <john.r.fallows@gmail.com> wrote:
> The recent delivery ADF Faces codebase with the missing jsf-mock dependency
> got me thinking...
>
>    - "Do we really need hand-written (or possibly generated) mock
>    implementation classes as a dependency?"
>    - "What strategy should we follow for our own classes that require
>    mock implementations?"
>
> For future test development, we might benefit from using jMock which doesn't
> require a separate set of mock class implementations to mock the interfaces
> / abstract classes.
>
> http://jmock.codehaus.org/getting-started.html
>
> Interestingly, jMock can leverage CGLib to manage dynamic proxy creation of
> abstract classes, and produces extremely readable unit tests that capture
> the semantics of the code being tested.
>
> Does anyone have jMock or mock object experiences to share?
>
> tc,
> -john.
> --
> http://apress.com/book/bookDisplay.html?bID=10044
> Author: Pro JSF and Ajax: Building Rich Internet Components, Apress
>
>

Mime
View raw message