blob: ed4fde4d3cde2a441dbdcda241be17fda4b0ae6f [file] [log] [blame]
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<faqs id="FAQ" title="Frequently Asked Questions">
<part id="General">
<faq id="What is a Mojo Testing Harness">
<question>What is a Mojo Testing Harness?</question>
<answer>
<p>
A unit test attempts to verify a mojo as an isolated unit, by mocking out the rest of the Maven environment.
A mojo unit test does not attempt to run your plugin in the context of a real Maven build.
Unit tests are designed to be fast.
</p>
<p>
This testing library is <b>NOT</b> designed for integration or functional testing.
</p>
</answer>
</faq>
<faq id="What kinds of unit tests are supported">
<question>What kind of unit tests are supported?</question>
<answer>
<p>
<dl>
<dt>TestCase from JUnit</dt>
<dd>You could use the <a href="http://junit.org/">JUnit framework</a> to test your plugin in
the same way you'd write any other JUnit test cases, i.e. by writing a test class which extends
<i>TestCase</i>.</dd>
<dt>TestCase from Plexus</dt>
<dd>Mojos are written to take specific advantage of the <a href="http://plexus.codehaus.org/">Plexus</a>
container. If you need Plexus container services, you could write your class which extends <i>PlexusTestCase</i>,
instead of <i>TestCase</i>.</dd>
<dt>TestCase from Testing Harness</dt>
<dd>If you need to inject Maven objects into your mojo, you could use the <i>maven-plugin-testing-harness</i>.
The <i>maven-plugin-testing-harness</i> is explicitly intended to test the
<i>org.apache.maven.reporting.AbstractMavenReport#execute()</i> implementation.</dd>
</dl>
</p>
</answer>
</faq>
</part>
</faqs>