Thomas Fischer <[EMAIL PROTECTED]> writes:

> Hi all,
>
> we have a maven plugin which generates java code, and we would like to
> unit-test it. One obvious test for such a plugin is to let it generate some
> code, compile that code, and unit-test the generated code.
>
> For this, the following steps need to be executed:
> 1) compile the plugin mojo
> 2) compile the test case which starts the plugin mojo in order to generate
> code
> 3) execute the test case which starts the plugin mojo in order to generate
> code
> 4) compile the generated code
> 5) compile the test cases which test the generated code
> 6) execute the test cases which test the generated code
>

Hello Thomas,
IMHO, this is not unit testing but functional testing of your plugin's
behavior. In such cases, I usually follow the simple approach of
having a separate integration test module that depends on the plugin
and executes test projects using maven-verifier. There are other
options available at 
http://maven.apache.org/developers/committer-testing-plugins.html
but I did not find them very satisfying (quite brittle, depends on
snapshots that depend on things...).

I have learnt to favour large number of modules with small poms: The
dependency mechanism handles the scheduling of plugins executions
better and more clearly than within a pom. I would like to know BTW if
this was intended in maven's design or just a side effect.

HTH
-- 
OQube < software engineering \ génie logiciel >
Arnaud Bailly, Dr.
\web> http://www.oqube.com


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

Reply via email to