> -----Original Message-----
> From: Jesse McConnell [mailto:[EMAIL PROTECTED]
> Sent: mardi 21 février 2006 00:45
> To: Maven Developers List
> Subject: Re: plugin testing
> 
> ok, I fiddled around a bit today with the clean plugin as a basic test
> case...
> 
> I really don't like the idea of putting setters on the mojo...not sure
> why,
> but it bugs me, probably because it is really only putting them there for
> testing purposes which is generally a no-no.

Funnily it's quite the opposite for me. When a unit test wants something
that is not in the main source files, I consider this as a code smell. It
usually means my code is not flexible enough or has a design issue and needs
refactoring.

In addition, I personally believe private field injection is a bit too
"magical" to my taste. We had discussed allowing setters in the past.

I guess you're not yet part of the unit testing addicts who consider that
unit testing is a design activity and that tests are a side-effect of
this... ;-)

[...]

> So I am curious as to what people think about that idea of having the
> mojo's
> setup in that way?  It seems a bit heavywieght for the clean plugin but
> how
> important is it to not put those setters on the mojo?  I have always been
> a
> bit of a fan for the correct conceptual way as opposed to the cheap and
> easy...though the cheap and easy can be faster :)

For me the conceptually correct one is almost always the mock solution
because it forces you to refactor to offer a flexible and open architecture.
However sometime you don't have the time for this and you go for stubs. But
then you risk adding to your technical debt
(http://www.martinfowler.com/bliki/TechnicalDebt.html). Now I agree it's not
always that black and white...

BTW, I'm playing the devil's advocate here so take my words with a grain of
salt. I'm just answering to fuel the conversation! :-)

[...]

> so I am not really proposing anything with this followup mail...I'll
> generate a patch with my first test case setup for the clean plugin and
> put
> that in jira...  I am however wondering if people generally like the
> plexified approach for the plugin implementation?  I wouldn't be adverse
> to
> converting a couple more over to see how they look....and it does make
> them
> feel a bit more modular and useful outside of maven for a toolset like
> axistools, sablecc, or javacc since normal people don't have a facility
> for
> injecting those params..

I think you're right and the next step is probably to see some tests in
action. BTW it could be interesting to see tests for the same plugin coded
with both approaches (after refactoring to suit the mock approach, if need
be ;-)).

-Vincent

> On 2/19/06, Jesse McConnell <[EMAIL PROTECTED]> wrote:
> >
> > after reading up on mocks from the links that vincent posted, I am going
> > to take a stab at putting together a minor set of these to work with for
> a
> > couple of the plugins...just to see how it would work out.  Hopefully I
> can
> > get with vincent a bit tomorrow to make sure I get it close to right the
> > first time
> >
> > jesse
> >
> > On 2/18/06, Brett Porter <[EMAIL PROTECTED]> wrote:
> > >
> > > Vincent Massol wrote:
> > > > I think what you're describing is a stub but not a mock. The
> advantage
> > > of a
> > > > dynamic mock is that you don't need to code any method. It's the
> user
> > > of the
> > > > mock which says what behavior it should have for the methods it
> calls
> > > on the
> > > > mock.
> > >
> > > You're right, I've always referred to stubs incorrectly as mocks. I
> > > meant a stub. I think it's in our interest to produce these to make
> > > testing easier and more consistent for everyone.
> > >
> > > I'm interested to see your thoughts on the mocks eventually though -
> > > I've never really done anything with them since I was reading JiA
> (which
> > > I don't have any more :(
> > >
> > > - Brett
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
> >
> > --
> > jesse mcconnell
> > jesseDOTmcconnellATgmailDOTcom
> 
> 
> 
> 
> --
> jesse mcconnell
> jesseDOTmcconnellATgmailDOTcom






___________________________________________________________________________
Nouveau : téléphonez moins cher avec Yahoo! Messenger ! Découvez les tarifs 
exceptionnels pour appeler la France et l'international.
Téléchargez sur http://fr.messenger.yahoo.com

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

Reply via email to