Modified: maven/website/content/plugin-developers/plugin-testing.html
==============================================================================
--- maven/website/content/plugin-developers/plugin-testing.html (original)
+++ maven/website/content/plugin-developers/plugin-testing.html Sat Feb 18 
20:40:58 2023
@@ -2,7 +2,7 @@
 
 
 <!--
- | Generated by Apache Maven Doxia Site Renderer 2.0.0-M4 from 
content/markdown/plugin-developers/plugin-testing.md at 2023-02-18
+ | Generated by Apache Maven Doxia Site Renderer 2.0.0-M4 from 
content/apt/plugin-developers/plugin-testing.apt at 2023-02-18
  | Rendered using Apache Maven Fluido Skin 1.11.1
 -->
 <html xmlns="http://www.w3.org/1999/xhtml"; lang="">
@@ -11,7 +11,8 @@
     <meta name="viewport" content="width=device-width, initial-scale=1" />
     <meta name="generator" content="Apache Maven Doxia Site Renderer 2.0.0-M4" 
/>
     <meta name="author" content="Vincent Siveton" />
-    <meta name="date" content="2008-01-01, 2015-06-16" />
+    <meta name="date" content="2008-01-01
+2015-06-16" />
     <title>Maven &#x2013; Developers centre - Testing Plugins 
Strategies</title>
     <link rel="stylesheet" href="../css/apache-maven-fluido-1.11.1.min.css" />
     <link rel="stylesheet" href="../css/site.css" />
@@ -48,7 +49,7 @@
           <ul class="breadcrumb">
       <li class=""><a href="https://www.apache.org/"; class="externalLink" 
title="Apache">Apache</a><span class="divider">/</span></li>
       <li class=""><a href="../index.html" title="Maven">Maven</a><span 
class="divider">/</span></li>
-    <li class="active ">Developers centre - Testing Plugins Strategies <a 
href="https://github.com/apache/maven-site/tree/master/content/markdown/plugin-developers/plugin-testing.md";><img
 src="../images/accessories-text-editor.png" title="Edit" /></a></li>
+    <li class="active ">Developers centre - Testing Plugins Strategies <a 
href="https://github.com/apache/maven-site/tree/master/content/apt/plugin-developers/plugin-testing.apt";><img
 src="../images/accessories-text-editor.png" title="Edit" /></a></li>
         <li id="publishDate" class="pull-right"><span class="divider">|</span> 
Last Published: 2023-02-18</li>
         <li class="pull-right"><span class="divider">|</span>
 <a href="../scm.html" title="Get Sources">Get Sources</a></li>
@@ -136,45 +137,25 @@
           </div>
         </header>
         <main id="bodyColumn"  class="span10" >
-<!--
-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.
--->
-<section><section>
-<h2>Introduction</h2>
-<p>Currently, Maven only supports unit testing out of the box. This document 
is intended to help Maven Developers test plugins with unit tests, integration 
tests, and functional tests.</p><!--   <<Note: There are a lot of different 
ways to test a Maven plugin.>>  For a review of different strategies and tools, 
please refer to 
{{{http://docs.codehaus.org/display/MAVENUSER/Review+of+Plugin+Testing+Strategies}Review
 of Plugin Testing Strategies}} -->
-</section><section>
-<h2>Testing Styles: Unit Testing vs. Functional/Integration Testing</h2>
+<section>
+<h1>Introduction</h1>
+<p>Currently, Maven only supports unit testing out of the box. This document 
is intended to help Maven Developers test plugins with unit tests, integration 
tests, and functional tests.</p></section><section>
+<h1>Testing Styles: Unit Testing vs. Functional/Integration Testing</h1>
 <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>A functional/integration test attempts to use a mojo in a real Maven build, 
by launching a real instance of Maven in a real project. Normally this requires 
you to construct special dummy Maven projects with real POM files. Often this 
requires you to have already installed your plugin into your local repository 
so it can be used in a real Maven build. Functional tests run much more slowly 
than unit tests, but they can catch bugs that you may not catch with unit 
tests.</p>
 <p>The general wisdom is that your code should be mostly tested with unit 
tests, but should also have some functional tests.</p></section><section>
-<h2>Unit Tests</h2><section>
-<h3>Using JUnit alone</h3>
+<h1>Unit Tests</h1><section>
+<h2>Using JUnit alone</h2>
 <p>In principle, you can write a unit test of a plugin Mojo the same way you'd 
write any other JUnit test case, by writing a class that <code>extends 
TestCase</code>.</p>
 <p>However, most mojos need more information to work properly. For example, 
you'll probably need to inject a reference to a MavenProject, so your mojo can 
query project variables.</p></section><section>
-<h3>Using PlexusTestCase</h3>
+<h2>Using PlexusTestCase</h2>
 <p>Mojo variables are injected using Plexus, and many Mojos are written to 
take specific advantage of the Plexus container (by executing a lifecycle or 
having various injected dependencies).</p>
 <p>If all you need are Plexus container services, you can write your class 
with <code>extends PlexusTestCase</code> instead of TestCase.</p>
 <p>With that said, if you need to inject Maven objects into your mojo, you'll 
probably prefer to use the maven-plugin-testing-harness.</p></section><section>
-<h3>maven-plugin-testing-harness</h3>
+<h2>maven-plugin-testing-harness</h2>
 <p>The <a 
href="/plugin-testing/maven-plugin-testing-harness/">maven-plugin-testing-harness</a>
 is explicitly intended to test the 
<code>org.apache.maven.reporting.AbstractMavenReport#execute()</code> 
implementation.</p>
 <p>In general, you need to include <code>maven-plugin-testing-harness</code> 
as a dependency, and create a *MojoTest (by convention) class which 
<code>extends AbstractMojoTestCase</code>.</p>
-
-<div class="source"><pre class="prettyprint linenums"><code 
class="language-xml">...
+<div class="source"><pre class="prettyprint linenums">...
   &lt;dependencies&gt;
     ...
     &lt;dependency&gt;
@@ -185,10 +166,8 @@ under the License.
     &lt;/dependency&gt;
     ...
   &lt;/dependencies&gt;
-...
-</code></pre></div>
-
-<div class="source"><pre class="prettyprint linenums"><code 
class="language-java">public class YourMojoTest
+...</pre></div>
+<div class="source"><pre class="prettyprint linenums">public class YourMojoTest
     extends AbstractMojoTestCase
 {
     /**
@@ -212,19 +191,17 @@ under the License.
 
         assertNotNull( mojo );
     }
-}
-</code></pre></div>
-<p>For more information, refer to <a 
href="http://cwiki.apache.org/confluence/display/MAVENOLD/Maven+Plugin+Harness"; 
class="externalLink">Maven Plugin Harness 
Wiki</a></p></section></section><section>
-<h2>Integration/Functional testing</h2><section>
-<h3>maven-verifier</h3>
+}</pre></div>
+<p>For more information, refer to <a class="externalLink" 
href="http://cwiki.apache.org/confluence/display/MAVENOLD/Maven+Plugin+Harness";>Maven
 Plugin Harness Wiki</a></p></section></section><section>
+<h1>Integration/Functional testing</h1><section>
+<h2>maven-verifier</h2>
 <p>maven-verifier tests are run using JUnit or TestNG, and provide a simple 
class allowing you to launch Maven and assert on its log file and built 
artifacts. It also provides a ResourceExtractor, which extracts a Maven project 
from your src/test/resources directory into a temporary working directory where 
you can do tricky stuff with it. Follow the <a 
href="/shared/maven-verifier/getting-started.html">Getting Started</a> guide to 
learn more about creating maven-verifier tests.</p>
-<p>Maven itself uses maven-verifier to run its core integration tests. For 
more information, please refer to <a 
href="https://cwiki.apache.org/confluence/display/MAVEN/Creating+a+Maven+Integration+Test";
 class="externalLink">Creating a Maven Integration Test</a>.</p>
-<p><strong>Note</strong>: maven-verifier and maven-verifier-plugin sound 
similar, but are totally different unrelated pieces of code. 
maven-verifier-plugin simply verifies the existence/absence of files on the 
filesystem. You could use it for functional testing, but you may need more 
features than maven-verifier-plugin provides.</p></section><section>
-<h3>maven-invoker-plugin</h3>
-<p>You can use <a 
href="https://maven.apache.org/plugins/maven-invoker-plugin/"; 
class="externalLink">maven-invoker-plugin</a> to invoke Maven and to provide 
some BeanShell/Groovy tests. Tests written in this way don't run under 
JUnit/TestNG; instead, they're run by Maven itself.</p>
-<p>You can take a look at the <a 
href="https://svn.apache.org/repos/asf/maven/plugins/trunk/maven-install-plugin/src/it/";
 class="externalLink">maven-install-plugin</a> how there are integration tests 
are written.</p>
-
-<div class="source"><pre class="prettyprint linenums"><code 
class="language-xml">&lt;project 
xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot; 
xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
+<p>Maven itself uses maven-verifier to run its core integration tests. For 
more information, please refer to <a class="externalLink" 
href="https://cwiki.apache.org/confluence/display/MAVEN/Creating+a+Maven+Integration+Test";>Creating
 a Maven Integration Test</a>.</p>
+<p><b>Note</b>: maven-verifier and maven-verifier-plugin sound similar, but 
are totally different unrelated pieces of code. maven-verifier-plugin simply 
verifies the existence/absence of files on the filesystem. You could use it for 
functional testing, but you may need more features than maven-verifier-plugin 
provides.</p></section><section>
+<h2>maven-invoker-plugin</h2>
+<p>You can use <a class="externalLink" 
href="https://maven.apache.org/plugins/maven-invoker-plugin/";>maven-invoker-plugin</a>
 to invoke Maven and to provide some BeanShell/Groovy tests. Tests written in 
this way don't run under JUnit/TestNG; instead, they're run by Maven itself.</p>
+<p>You can take a look at the <a class="externalLink" 
href="https://svn.apache.org/repos/asf/maven/plugins/trunk/maven-install-plugin/src/it/";>maven-install-plugin</a>
 how there are integration tests are written.</p>
+<div class="source"><pre class="prettyprint linenums">&lt;project 
xmlns=&quot;http://maven.apache.org/POM/4.0.0&quot; 
xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
   xsi:schemaLocation=&quot;http://maven.apache.org/POM/4.0.0 
https://maven.apache.org/xsd/maven-4.0.0.xsd&quot;&gt;
   ...
   &lt;build&gt;
@@ -252,8 +229,7 @@ under the License.
     &lt;/plugins&gt;
   &lt;/build&gt;
   ...
-&lt;/project&gt;
-</code></pre></div></section></section></section>
+&lt;/project&gt;</pre></div></section></section>
         </main>
       </div>
     </div>


Reply via email to