You are viewing a plain text version of this content. The canonical link for it is here.
Posted to surefire-commits@maven.apache.org by df...@apache.org on 2008/01/26 03:03:13 UTC
svn commit: r615426 - in
/maven/surefire/trunk/maven-surefire-plugin/src/site:
apt/examples/debugging.apt apt/examples/single-test.apt
apt/examples/skipping-test.apt apt/index.apt site.xml
Author: dfabulich
Date: Fri Jan 25 18:03:12 2008
New Revision: 615426
URL: http://svn.apache.org/viewvc?rev=615426&view=rev
Log:
[SUREFIRE-436] Added documentation explaining how to debug tests. Also added some tips explaining how to skipTests with -DskipTests, and how to use patterns in the -Dtest parameter.
Added:
maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/debugging.apt
Modified:
maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/single-test.apt
maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/skipping-test.apt
maven/surefire/trunk/maven-surefire-plugin/src/site/apt/index.apt
maven/surefire/trunk/maven-surefire-plugin/src/site/site.xml
Added: maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/debugging.apt
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/debugging.apt?rev=615426&view=auto
==============================================================================
--- maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/debugging.apt (added)
+++ maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/debugging.apt Fri Jan 25 18:03:12 2008
@@ -0,0 +1,48 @@
+ ------
+ Debugging Tests
+ ------
+ Dan Fabulich
+ ------
+ January 2008
+ ------
+
+Debugging Tests
+
+ Sometimes you need to debug the tests exactly as Maven ran them. Here's how!
+
+Forked Tests
+
+ By default, Maven runs your tests in a separate ("forked") process. You can use the <<<maven.surefire.debug>>> property
+ to debug your forked tests remotely, like this:
+
++---+
+mvn -Dmaven.surefire.debug test
++---+
+
+ The tests will automatically pause and await a remote debugger on port 5005. You can then attach to the running tests
+ using Eclipse. You can setup a "Remote Java Application" launch configuration via the menu
+ command "Run" > "Open Debug Dialog..."
+
+ If you need to configure a different port, you may pass a more detailed value. For example, the value below will use port 8000
+ instead of port 5005.
+
++---+
+mvn -Dmaven.surefire.debug="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -Xnoagent -Djava.compiler=NONE" test
++---+
+
+Non-forked Tests
+
+ You can force Maven not to fork tests by configuring the <<<forkMode>>> configuration parameter.
+
++---+
+mvn -DforkMode=none test
++---+
+
+ Then all you need to do is debug Maven itself. Since Maven 2.0.8, Maven has shipped with a "mvnDebug" shell script that you can
+ use to launch Maven with convenient debugging options:
+
++---+
+mvnDebug -DforkMode=none test
++---+
+
+ Then you can attach Eclipse to Maven itself, which may be easier/more convenient than debugging the forked executable.
\ No newline at end of file
Modified: maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/single-test.apt
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/single-test.apt?rev=615426&r1=615425&r2=615426&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/single-test.apt (original)
+++ maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/single-test.apt Fri Jan 25 18:03:12 2008
@@ -15,5 +15,16 @@
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
+ The value for the <<<test>>> parameter is the name of the test class (without the extension; we'll strip off the extension if you accidentally provide one).
+
+ You may also use patterns to run a number of tests:
+
++---+
+mvn -Dtest=TestCi*le test
++---+
+
+ And you may use multiple names/patterns, separated by commas:
+
++---+
+mvn -Dtest=TestSquare,TestCi*le test
++---+
Modified: maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/skipping-test.apt
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/skipping-test.apt?rev=615426&r1=615425&r2=615426&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/skipping-test.apt (original)
+++ maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/skipping-test.apt Fri Jan 25 18:03:12 2008
@@ -10,7 +10,7 @@
Skipping Tests
- To skip running the tests for a particular project, set the <<skip>>
+ To skip running the tests for a particular project, set the <<skipTests>>
property to <<true>>.
+---+
@@ -22,7 +22,7 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
- <skip>true</skip>
+ <skipTests>true</skipTests>
</configuration>
</plugin>
</plugins>
@@ -34,6 +34,11 @@
You can also skip the tests via command line by executing the following command:
+---+
-mvn install -Dmaven.test.skip=true
+mvn install -DskipTests
+---+
+ If you absolutely must, you can also use the maven.test.skip property to skip compiling the tests. maven.test.skip is honored by Surefire and the compiler plugin.
+
++---+
+mvn install -Dmaven.test.skip=true
++---+
\ No newline at end of file
Modified: maven/surefire/trunk/maven-surefire-plugin/src/site/apt/index.apt
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-plugin/src/site/apt/index.apt?rev=615426&r1=615425&r2=615426&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-plugin/src/site/apt/index.apt (original)
+++ maven/surefire/trunk/maven-surefire-plugin/src/site/apt/index.apt Fri Jan 25 18:03:12 2008
@@ -49,6 +49,8 @@
* {{{examples/forking.html}Forking}}
+ * {{{examples/debugging.html}Debugging Tests}}
+
* {{{examples/system-properties.html}Using System Properties}}
* {{{examples/testng.html}Using TestNG}}
Modified: maven/surefire/trunk/maven-surefire-plugin/src/site/site.xml
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-plugin/src/site/site.xml?rev=615426&r1=615425&r2=615426&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-plugin/src/site/site.xml (original)
+++ maven/surefire/trunk/maven-surefire-plugin/src/site/site.xml Fri Jan 25 18:03:12 2008
@@ -33,6 +33,7 @@
<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="Debugging Tests" href="examples/debugging.html"/>
<item name="Using System Properties" href="examples/system-properties.html"/>
<item name="Using TestNG" href="examples/testng.html"/>
</menu>