com.sun.maven.junit
Class TestMojo

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by com.sun.maven.junit.TestMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

public class TestMojo
extends org.apache.maven.plugin.AbstractMojo

Runs tests


Field Summary
protected  String argLine
          Arbitrary JVM options to set on the command line.
protected  List<String> classpathElements
          The classpath elements of the project being tested.
protected  int concurrency
          Number of concurrent executions.
protected  String debugForkedProcess
          Attach a debugger to the forked JVM.
protected  boolean fork
          Option to specify the forking behavior.
protected  org.apache.maven.project.MavenProject project
           
protected  boolean quiet
          If true, the stdout/stderr from tests will not be copied to the console.
protected  boolean skipTests
          Set this to 'true' to skip running tests, but still compile them.
protected  Properties systemProperties
          List of System properties to pass to the JUnit tests.
protected  String test
          Specify this parameter to run individual tests by file name, overriding the includes/excludes parameters.
protected  boolean testFailureIgnore
          Set this to true to ignore a failure during testing.
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
TestMojo()
           
 
Method Summary
protected  LocalTestCaseRunner createTestCaseRunner()
           
 void execute()
           
 void executeForked()
          Executes tests in several child JVMs concurrently.
 void executeLocal()
           
 hudson.remoting.Channel fork(OutputStream output, ExecutorService executors)
          Forks a new JVM and pumps its output to the given OutputStream
 
Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

project

protected org.apache.maven.project.MavenProject project

classpathElements

protected List<String> classpathElements
The classpath elements of the project being tested.


testFailureIgnore

protected boolean testFailureIgnore
Set this to true to ignore a failure during testing. Its use is NOT RECOMMENDED, but quite convenient on occasion.


fork

protected boolean fork
Option to specify the forking behavior. True to fork, false to run in process.


concurrency

protected int concurrency
Number of concurrent executions. Specify -N means "N times #ofProcessors"


debugForkedProcess

protected String debugForkedProcess
Attach a debugger to the forked JVM. If set to "true", the process will suspend and wait for a debugger to attach on port 5005. If set to some other string, that string will be appended to the argLine, allowing you to configure arbitrary debuggability options (without overwriting the other options specified in the argLine).


test

protected String test
Specify this parameter to run individual tests by file name, overriding the includes/excludes parameters. Each pattern you specify here will be used to create an include pattern formatted like **/${test}.java, so you can just type "-Dtest=MyTest" to run a single test called "foo/MyTest.java". This parameter will override the TestNG suiteXmlFiles parameter. since 1.7 you can now use "-Dtest=MyTest#method" to execute only one method of the unit tests. Note * is supported too "-Dtest=MyTest#method*" to execute only method starting with method


quiet

protected boolean quiet
If true, the stdout/stderr from tests will not be copied to the console. (Note that they are always in the test result XML file, regardless of the value of this option.)


argLine

protected String argLine
Arbitrary JVM options to set on the command line. Used when forking.


systemProperties

protected Properties systemProperties
List of System properties to pass to the JUnit tests.


skipTests

protected boolean skipTests
Set this to 'true' to skip running tests, but still compile them. Its use is NOT RECOMMENDED, but quite convenient on occasion.

Constructor Detail

TestMojo

public TestMojo()
Method Detail

execute

public void execute()
             throws org.apache.maven.plugin.MojoExecutionException,
                    org.apache.maven.plugin.MojoFailureException
Throws:
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException

executeLocal

public void executeLocal()
                  throws org.apache.maven.plugin.MojoExecutionException
Throws:
org.apache.maven.plugin.MojoExecutionException

createTestCaseRunner

protected LocalTestCaseRunner createTestCaseRunner()

executeForked

public void executeForked()
                   throws org.apache.maven.plugin.MojoExecutionException,
                          org.apache.maven.plugin.MojoFailureException
Executes tests in several child JVMs concurrently.

Throws:
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException

fork

public hudson.remoting.Channel fork(OutputStream output,
                                    ExecutorService executors)
                             throws IOException
Forks a new JVM and pumps its output to the given OutputStream

Parameters:
output - The stream will be closed upon the completion of the process.
executors - Executes the remote requests.
Throws:
IOException


Copyright © 2011. All Rights Reserved.