The problem that I encountered on writing unit tests was that a lot of the
classes have uninitialized fields that plexus injects with values during run
time. I didn't want to start a plexus container (because then I am testing
more than one method); so I had to rely on stubs to do testing. One idea
that crossed my mind was either finding or writing a small utility for
injecting fields for unit tests. I think that this would alleviate some of
the problems with having to generate a lot of stubs. I did try using mock
objects but constructing the tests required knowing a fair amount of the
implementation details, which in itself can become a serious maintenance
issue.

Shane

On 5/30/07, Brett Porter <[EMAIL PROTECTED]> wrote:


On 30/05/2007, at 5:05 PM, Evan Worley wrote:

> Does anyone know of any documentation as to best practices for unit
> testing maven plugins?  It seems to be an inherently difficult task
> and I imagine it would require complex sets of mock objects.  Any
> advice or examples in this area would be appreciated.

We're working on improving the situation there - there are some
testing tools already but no write ups on how to use them. I'm told
the assembly plugin is the best example to work from.

- Brett

Reply via email to