Author: aramirez
Date: Tue Jul 25 07:49:28 2006
New Revision: 425406
URL: http://svn.apache.org/viewvc?rev=425406&view=rev
Log: (empty)
Added:
maven/plugins/trunk/maven-surefire-plugin/src/site/apt/examples/
maven/plugins/trunk/maven-surefire-plugin/src/site/apt/examples/class-loading.apt
maven/plugins/trunk/maven-surefire-plugin/src/site/apt/examples/forking.apt
maven/plugins/trunk/maven-surefire-plugin/src/site/apt/examples/inclusion-exclusion.apt
maven/plugins/trunk/maven-surefire-plugin/src/site/apt/examples/single-test.apt
maven/plugins/trunk/maven-surefire-plugin/src/site/apt/examples/skipping-test.apt
maven/plugins/trunk/maven-surefire-plugin/src/site/apt/examples/system-properties.apt
maven/plugins/trunk/maven-surefire-plugin/src/site/apt/examples/testng.apt
maven/plugins/trunk/maven-surefire-plugin/src/site/apt/index.apt
maven/plugins/trunk/maven-surefire-plugin/src/site/apt/usage.apt
maven/plugins/trunk/maven-surefire-plugin/src/site/fml/
maven/plugins/trunk/maven-surefire-plugin/src/site/fml/faq.fml
Modified:
maven/plugins/trunk/maven-surefire-plugin/pom.xml
maven/plugins/trunk/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java
maven/plugins/trunk/maven-surefire-plugin/src/site/site.xml
Modified: maven/plugins/trunk/maven-surefire-plugin/pom.xml
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-surefire-plugin/pom.xml?rev=425406&r1=425405&r2=425406&view=diff
==============================================================================
--- maven/plugins/trunk/maven-surefire-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-surefire-plugin/pom.xml Tue Jul 25 07:49:28 2006
@@ -3,13 +3,16 @@
<parent>
<artifactId>maven-plugins</artifactId>
<groupId>org.apache.maven.plugins</groupId>
- <version>1</version>
+ <version>2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>maven-surefire-plugin</artifactId>
<packaging>maven-plugin</packaging>
<name>Maven Surefire Plugin</name>
<version>2.3-SNAPSHOT</version>
+ <prerequisites>
+ <maven>2.0</maven>
+ </prerequisites>
<issueManagement>
<system>JIRA</system>
<url>http://jira.codehaus.org/browse/MSUREFIRE</url>
Modified:
maven/plugins/trunk/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java?rev=425406&r1=425405&r2=425406&view=diff
==============================================================================
---
maven/plugins/trunk/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java
(original)
+++
maven/plugins/trunk/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java
Tue Jul 25 07:49:28 2006
@@ -334,6 +334,7 @@
private ArtifactFactory artifactFactory;
/**
+ * The plugin remote repositories declared in the pom.
* @parameter expression="${project.pluginArtifactRepositories}"
*/
private List remoteRepositories;
@@ -350,6 +351,7 @@
private Properties originalSystemProperties;
/**
+ * Flag to disable the generation of report files in xml format.
* @parameter expression="${disableXmlReport}" default-value="false"
*/
private boolean disableXmlReport;
Added:
maven/plugins/trunk/maven-surefire-plugin/src/site/apt/examples/class-loading.apt
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-surefire-plugin/src/site/apt/examples/class-loading.apt?rev=425406&view=auto
==============================================================================
---
maven/plugins/trunk/maven-surefire-plugin/src/site/apt/examples/class-loading.apt
(added)
+++
maven/plugins/trunk/maven-surefire-plugin/src/site/apt/examples/class-loading.apt
Tue Jul 25 07:49:28 2006
@@ -0,0 +1,31 @@
+ ------
+ Class Loading Issues
+ ------
+ Brett Porter
+ ------
+ July 2006
+ ------
+
+Class Loading Issues
+
+ By default, Surefire loads classes using the default Java mechanism. However,
it can be set to use "child first" classloading, like
+ a web application - meaning your dependencies take precedence over those in
the JDK.
+ If you find this is necessary, you can do so by setting the
<<<childDelegation>>> flag to <<<true>>>:
+
++---+
+<project>
+ [...]
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <childDelegation>true</childDelegation>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ [...]
+</project>
++---+
\ No newline at end of file
Added:
maven/plugins/trunk/maven-surefire-plugin/src/site/apt/examples/forking.apt
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-surefire-plugin/src/site/apt/examples/forking.apt?rev=425406&view=auto
==============================================================================
--- maven/plugins/trunk/maven-surefire-plugin/src/site/apt/examples/forking.apt
(added)
+++ maven/plugins/trunk/maven-surefire-plugin/src/site/apt/examples/forking.apt
Tue Jul 25 07:49:28 2006
@@ -0,0 +1,38 @@
+ ------
+ Forking
+ ------
+ Brett Porter
+ ------
+ July 2006
+ ------
+
+Forking
+
+ If you need to run your tests in a new JVM process you can use the
<<<forkMode>>> option to start a new
+ JVM process once for all your tests, or start a new JVM process for each of
your tests. You can also set
+ any arbitrary options like <<<-enableassertions>>> or any other JVM options.
Here's an example of what
+ this might look like:
+
++---+
+<project>
+ [...]
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <forkMode>pertest</forkMode>
+ <argLine>-enableassertions</argLine>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ [...]
+</project>
++---+
+
+ <<Note:>> You do not need to manually enable assertions if you are using them
in your unit tests - Surefire enables
+ them on your test classes automatically under JDK 1.4+.
+
+ The default setting is <<<once>>>. It can also be set to <<<never>>> to run
in process for a small performance improvement.
\ No newline at end of file
Added:
maven/plugins/trunk/maven-surefire-plugin/src/site/apt/examples/inclusion-exclusion.apt
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-surefire-plugin/src/site/apt/examples/inclusion-exclusion.apt?rev=425406&view=auto
==============================================================================
---
maven/plugins/trunk/maven-surefire-plugin/src/site/apt/examples/inclusion-exclusion.apt
(added)
+++
maven/plugins/trunk/maven-surefire-plugin/src/site/apt/examples/inclusion-exclusion.apt
Tue Jul 25 07:49:28 2006
@@ -0,0 +1,76 @@
+ ------
+ Inclusions and Exclusions of Tests
+ ------
+ Allan Ramirez
+ ------
+ July 2006
+ ------
+
+Inclusions and Exclusions of Tests
+
+* Inclusions
+
+ By default, the surefire plugin will automatically include all test classes
+ with the following wildcard patterns:
+
+ * <"**/Test*.java"> - includes all of its subdirectory and all java
+ filename that starts with "Test".
+
+ * <"**/*Test.java"> - includes all of its subdirectory and all java
+ filename that ends with "Test".
+
+ * <"**/*TestCase.java"> - includes all of its subdirectory and all java
+ filename that ends with "TestCase".
+
+ []
+
+ If the test classes does not go with the naming convention, then configure
+ surefire plugin and specify the test you want to include.
+
++---+
+<project>
+ [...]
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <includes>
+ <include>Sample.java</include>
+ </includes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ [...]
+</project>
++---+
+
+* Exclusions
+
+ There are certain times that some tests are causing the build to fail.
+ Excluding them is one of the best workaround to continue the build.
+ Exclusions can be done by configuring the <<excludes>> property of the
+ plugin.
+
++---+
+<project>
+ [...]
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <excludes>
+ <exclude>**/TestCircle.java</exclude>
+ <exclude>**/TestSquare.java</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ [...]
+</project>
++---+
\ No newline at end of file
Added:
maven/plugins/trunk/maven-surefire-plugin/src/site/apt/examples/single-test.apt
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-surefire-plugin/src/site/apt/examples/single-test.apt?rev=425406&view=auto
==============================================================================
---
maven/plugins/trunk/maven-surefire-plugin/src/site/apt/examples/single-test.apt
(added)
+++
maven/plugins/trunk/maven-surefire-plugin/src/site/apt/examples/single-test.apt
Tue Jul 25 07:49:28 2006
@@ -0,0 +1,19 @@
+ ------
+ Running a Single Test
+ ------
+ Allan Ramirez
+ ------
+ July 2006
+ ------
+
+Running a Single Test
+
+ During development, you may run a single test class repeatedly. To run this
+ through Maven, set the <<<test>>> property to a specific test case.
+
++---+
+mvn -Dtest=TestCircle test
++---+
+
+ The value for the <<<test>>> parameter is the name of the test class(without
+ the extension).
\ No newline at end of file
Added:
maven/plugins/trunk/maven-surefire-plugin/src/site/apt/examples/skipping-test.apt
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-surefire-plugin/src/site/apt/examples/skipping-test.apt?rev=425406&view=auto
==============================================================================
---
maven/plugins/trunk/maven-surefire-plugin/src/site/apt/examples/skipping-test.apt
(added)
+++
maven/plugins/trunk/maven-surefire-plugin/src/site/apt/examples/skipping-test.apt
Tue Jul 25 07:49:28 2006
@@ -0,0 +1,39 @@
+ ------
+ Skipping Test
+ ------
+ Johnny Ruiz
+ Brett Porter
+ Allan Ramirez
+ ------
+ July 2006
+ ------
+
+Skipping Tests
+
+ To skip running the tests for a particular project, set the <<skip>>
+ property to <<true>>.
+
++---+
+<project>
+ [...]
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ [...]
+</project>
++---+
+
+ You can also skip the tests via command line by executing the following
command:
+
++---+
+mvn install -Dmaven.test.skip=true
++---+
+
Added:
maven/plugins/trunk/maven-surefire-plugin/src/site/apt/examples/system-properties.apt
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-surefire-plugin/src/site/apt/examples/system-properties.apt?rev=425406&view=auto
==============================================================================
---
maven/plugins/trunk/maven-surefire-plugin/src/site/apt/examples/system-properties.apt
(added)
+++
maven/plugins/trunk/maven-surefire-plugin/src/site/apt/examples/system-properties.apt
Tue Jul 25 07:49:28 2006
@@ -0,0 +1,34 @@
+ ------
+ Using System Properties
+ ------
+ Allan Ramirez
+ ------
+ July 2006
+ ------
+
+Using System Properties
+
+ To add a System property, use the following configuration:
+
++---+
+<project>
+ [...]
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <systemProperties>
+ <property>
+ <name>propertyName</name>
+ <value>propertyValue</value>
+ </property>
+ </systemProperties>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ [...]
+</project>
++---+
Added:
maven/plugins/trunk/maven-surefire-plugin/src/site/apt/examples/testng.apt
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-surefire-plugin/src/site/apt/examples/testng.apt?rev=425406&view=auto
==============================================================================
--- maven/plugins/trunk/maven-surefire-plugin/src/site/apt/examples/testng.apt
(added)
+++ maven/plugins/trunk/maven-surefire-plugin/src/site/apt/examples/testng.apt
Tue Jul 25 07:49:28 2006
@@ -0,0 +1,100 @@
+ ------
+ Using TestNG
+ ------
+ Brett Porter <[EMAIL PROTECTED]>
+ ------
+ 2 May 2006
+ ------
+
+Using TestNG
+
+* Configuring TestNG
+
+ To get started with TestNG, include the following dependency in your project:
+
++---+
+[...]
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <version>4.7</version>
+ <scope>test</scope>
+ <classifier>jdk15</classifier>
+ </dependency>
+[...]
++---+
+
+ <<Note:>> if you are using JDK 1.4 Javadoc annotations for your TestNG
tests, replace jdk15 with jdk14 above.
+
+ This is the only step that is required to get started - you can now create
tests in your test source directory
+ (eg, <<<src/test/java>>>, and as long as they are named using the defaults
such as *Test.java they will be run
+ by Surefire as TestNG tests.
+
+ If you'd like to use a different naming scheme, you can change the
<<<includes>>> parameter, as discussed in the
+ {{{inclusion-exclusion.html}Inclusions and Exclusions of Tests}} example.
+
+* Using Suite XML Files
+
+ Another alternative is to use test NG suite XML files. This allows flexbile
configuration of the tests to be run.
+ These files are created as normal, and then added to the Surefire plugin
configuration:
+
++---+
+[...]
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <suiteXmlFiles>
+ <suiteXmlFile>testng.xml</suiteXmlFile>
+ </suiteXmlFiles>
+ </configuration>
+ </plugin>
+[...]
++---+
+
+ This configuration will override the includes and excludes patterns and run
all tests in the suite files.
+
+* Using Groups
+
+ TestNG allows you to group your tests. You can then execute a specific group
or groups. To do this with Surefire,
+ use the <<<groups>>> parameter, for example:
+
++---+
+[...]
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <groups>functest,perftest</groups>
+ </configuration>
+ </plugin>
+[...]
++---+
+
+ Likewise, the <<<excludedGroups>>> parameter can be used to run all but a
certain set of groups.
+
+* Running tests in parallel
+
+ TestNG allows you to run your tests in parallel, including JUnit tests. To
do this, you must enable the
+ <<<parallel>>> parameter, and may change the <<<threadCount>>> parameter if
the default of 5 is not sufficient.
+ For example:
+
++---+
+[...]
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <parallel>true</parallel>
+ <threadCount>10</threadCount>
+ </configuration>
+ </plugin>
+[...]
++---+
+
+ This is particularly useful for slow tests that can have high concurrency,
or to quickly and roughly assess the independance
+ and thread safety of your tests and code.
+
+ For more information on TestNG, see the project {{{http://www.testng.org}
web site}}.
+
+
Added: maven/plugins/trunk/maven-surefire-plugin/src/site/apt/index.apt
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-surefire-plugin/src/site/apt/index.apt?rev=425406&view=auto
==============================================================================
--- maven/plugins/trunk/maven-surefire-plugin/src/site/apt/index.apt (added)
+++ maven/plugins/trunk/maven-surefire-plugin/src/site/apt/index.apt Tue Jul 25
07:49:28 2006
@@ -0,0 +1,56 @@
+ ------
+ Introduction
+ ------
+ Allan Ramirez
+ ------
+ July 2006
+ ------
+
+Maven Surefire Plugin
+
+ The surefire plugin is used during the <<<test>>> phase of the build
+ lifecycle to execute the unit tests of an application. It generate reports
+ in 2 different file formats:
+
+ * Plain text file (*.txt)
+
+ * Xml file (*.xml)
+
+ []
+
+ By default, these files are generated at
<<<${basedir}/target/surefire-reports>>>.
+
+ For an html format of the report, please see the
+
{{{http://maven.apache.org/plugins/maven-surefire-report-plugin}maven-surefire-report-plugin}}.
+
+* Goals Overview
+
+ The surefire plugin has only 1 goal:
+
+ * {{{test-mojo.html}surefire:test}} runs the unit tests of an application.
+
+ []
+
+* Usage
+
+ Instructions on how to use the surefire plugin can be found
{{{usage.html}here}}.
+
+* Examples
+
+ The following examples show how to use the surefire plugin in more advanced
usecases:
+
+ * {{{examples/skipping-test.html}Skipping Tests}}
+
+ * {{{examples/inclusion-exclusion.html}Inclusions and Exclusions of Tests}}
+
+ * {{{examples/single-test.html}Running a Single Test}}
+
+ * {{{examples/class-loading.html}Class Loading Issues}}
+
+ * {{{examples/forking.html}Forking}}
+
+ * {{{examples/system-properties.html}Using System Properties}}
+
+ * {{{examples/testng.html}Using TestNG}}
+
+ []
Added: maven/plugins/trunk/maven-surefire-plugin/src/site/apt/usage.apt
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-surefire-plugin/src/site/apt/usage.apt?rev=425406&view=auto
==============================================================================
--- maven/plugins/trunk/maven-surefire-plugin/src/site/apt/usage.apt (added)
+++ maven/plugins/trunk/maven-surefire-plugin/src/site/apt/usage.apt Tue Jul 25
07:49:28 2006
@@ -0,0 +1,47 @@
+ ------
+ Usage
+ ------
+ Brett Porter
+ Allan Ramirez
+ ------
+ July 2006
+ ------
+
+Usage
+
+ The surefire plugin can be invoked by calling the <<<test>>> phase of the
+ build lifecycle.
+
++---+
+mvn test
++---+
+
+* Using different testing providers
+
+ Tests in your test source directory can be any combination of the following:
+
+ * TestNG
+
+ * JUnit
+
+ * POJO
+
+ Which providers are available is controlled simply by the inclusion of the
appropriate
+ dependencies (ie, junit:junit for JUnit, org.testng:testng 4.7+ for TestNG).
Since this is
+ required to compile the test classes anyway, no additional configuration is
required.
+
+ Note that any normal Surefire integration works identically no matter which
providers are
+ in use - so you can still produce a Cobertura report and a Surefire results
report on your
+ project web site for your TestNG tests, for example.
+
+ The POJO provider above allows you to write tests that do not depend on
JUnit. They behave in
+ the same way, running all <<<test*>>> methods that are public in the class,
but the API
+ dependency is not required. To perform assertions, the JDK 1.4 <<<assert>>>
keyword can be
+ used, or you can use <<<org.apache.maven.surefire.assertion.Assert>>>.
+
+ All of the providers support the following configuration. However, there are
additional
+ options available if you are running TestNG tests (including if you are
using TestNG to
+ execute your JUnit tests, which occurs by default if both are present in
Surefire).
+
+ See {{{examples/testng.html} Using TestNG}} for more information.
+
Added: maven/plugins/trunk/maven-surefire-plugin/src/site/fml/faq.fml
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-surefire-plugin/src/site/fml/faq.fml?rev=425406&view=auto
==============================================================================
--- maven/plugins/trunk/maven-surefire-plugin/src/site/fml/faq.fml (added)
+++ maven/plugins/trunk/maven-surefire-plugin/src/site/fml/faq.fml Tue Jul 25
07:49:28 2006
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<faqs id="FAQ" title="Frequently Asked Questions">
+ <part id="General">
+ <faq id="compile-error-reports">
+ <question>Does surefire plugin supports JUnit 4.0?</question>
+ <answer>
+ <p>
+ No. But an issue is already filed. Please see
+ <a
href="http://jira.codehaus.org/browse/SUREFIRE-31">SUREFIRE-31</a>
+ for more references.
+ </p>
+ </answer>
+ </faq>
+ </part>
+</faqs>
Modified: maven/plugins/trunk/maven-surefire-plugin/src/site/site.xml
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-surefire-plugin/src/site/site.xml?rev=425406&r1=425405&r2=425406&view=diff
==============================================================================
--- maven/plugins/trunk/maven-surefire-plugin/src/site/site.xml (original)
+++ maven/plugins/trunk/maven-surefire-plugin/src/site/site.xml Tue Jul 25
07:49:28 2006
@@ -1,26 +1,8 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
-<!--
-/*
- * Copyright 2001-2005 The Apache Software Foundation.
- *
- * Licensed 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.
- */
--->
-
<project name="Maven Surefire Plugin">
<bannerLeft>
- <name>Maven Surefire Plugin</name>
+ <name>Maven Install Plugin</name>
<src>http://maven.apache.org/images/apache-maven-project.png</src>
<href>http://maven.apache.org/</href>
</bannerLeft>
@@ -33,10 +15,22 @@
</links>
<menu name="Overview">
- <item name="Introduction" href="introduction.html"/>
- <item name="How to Use" href="howto.html"/>
- <item name="Using TestNG" href="testng.html"/>
+ <item name="Introduction" href="index.html"/>
+ <item name="Goals" href="plugin-info.html" />
+ <item name="Usage" href="usage.html"/>
+ <item name="FAQ" href="faq.html"/>
+ </menu>
+
+ <menu name="Examples">
+ <item name="Skipping Tests" href="examples/skipping-test.html" />
+ <item name="Inclusions and Exclusions of Tests"
href="examples/inclusion-exclusion.html" />
+ <item name="Running a Single Test" href="examples/single-test.html" />
+ <item name="Class Loading Issues" href="examples/class-loading.html" />
+ <item name="Forking" href="examples/forking.html" />
+ <item name="Using System Properties"
href="examples/system-properties.html" />
+ <item name="Using TestNG" href="examples/testng.html"/>
</menu>
+
${reports}
</body>
</project>