On Thu, 8 Sep 2005, John Fallows wrote:

You could try out the maven-it-plugin in the sandbox, if you're using
svn head.

Just place test projects in src/it/ and bind the maven-it-plugin
to a phase after 'install', using the 'fork' goal.

Unfortunately to be able to test a plugin it needs to be installed
for maven to find it. I'm working on a way to let maven find and use that
plugin so it doesn't need to be installed (it might already work since
the 'current' project is in the reactor. You'd have to specify
a dependency on it in the test project too, I think).

As you can see it's not finished yet, so if you feel like
experimenting, you're welcome.

If not, take a look at the maven-eclipse-plugin. The JUnit tests
'fake' being maven, loading a fake pom, manually instantiating the
Mojo, and using setter methods to fill in the parameters,
and call the execute() method. I'm hoping to provide a general
plugin testing framework (read: plugin :)) in maven-it-plugin
so this 'hacking' isn't necessary.

-- Kenney

> What is the recommended approach for testing m2 plugin Java code?
>
> I would like to be able to write a JUnit test, but need to simulate
> the bootstrap process of initializing the various properties to their
> defaults, and possibly setting some non-default parameter values, all
> before Mojo.execute() is called.
>
> Is there any existing solution for this?  Perhaps a reusable JUnit
> TestCase base class that could be extended?
>
> Thanks in advance,
> John Fallows.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

--
Kenney Westerhof
http://www.neonics.com
GPG public key: http://www.gods.nl/~forge/kenneyw.key

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

Reply via email to