junit:test

Full name:

org.kohsuke:maven-junit-plugin:1.10:test

Description:

Runs tests

Attributes:

  • Requires a Maven project to be executed.
  • Requires dependency resolution of artifacts in scope: test.
  • Binds by default to the lifecycle phase: test.

Required Parameters

Name Type Since Description
project MavenProject - (no description)

Optional Parameters

Name Type Since Description
argLine String - Arbitrary JVM options to set on the command line. Used when forking.
concurrency int - Number of concurrent executions. Specify -N means "N times #ofProcessors"
debugForkedProcess String - 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).
excludes List - A list of <exclude> elements specifying the tests (by pattern) that should be excluded in testing. When not specified and when the test parameter is not specified, the default excludes will be
<excludes>
 <exclude>**/*$*</exclude>
</excludes>
(which excludes all inner classes).
This parameter is ignored if the TestNG suiteXmlFiles parameter is specified.
fork boolean - Option to specify the forking behavior. True to fork, false to run in process.
quiet boolean - 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.)
Default value is: true.
reportsDirectory File - Base directory where all reports are written to.
skipTests boolean - Set this to 'true' to skip running tests, but still compile them. Its use is NOT RECOMMENDED, but quite convenient on occasion.
systemProperties Properties - List of System properties to pass to the JUnit tests.
test String - 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
testFailureIgnore boolean - Set this to true to ignore a failure during testing. Its use is NOT RECOMMENDED, but quite convenient on occasion.
timeout int - Abort the test if it doesn't complete in the given number of seconds. 0 means no timeout.

Parameter Details

argLine:

Arbitrary JVM options to set on the command line. Used when forking.
  • Type: java.lang.String
  • Required: No
  • Expression: ${argLine}

concurrency:

Number of concurrent executions. Specify -N means "N times #ofProcessors"
  • Type: int
  • Required: No
  • Expression: ${maven.junit.concurrency}

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).
  • Type: java.lang.String
  • Required: No
  • Expression: ${maven.surefire.debug}

excludes:

A list of <exclude> elements specifying the tests (by pattern) that should be excluded in testing. When not specified and when the test parameter is not specified, the default excludes will be
<excludes>
 <exclude>**/*$*</exclude>
</excludes>
(which excludes all inner classes).
This parameter is ignored if the TestNG suiteXmlFiles parameter is specified.
  • Type: java.util.List
  • Required: No

fork:

Option to specify the forking behavior. True to fork, false to run in process.
  • Type: boolean
  • Required: No
  • Expression: ${maven.junit.fork}

project:

(no description)
  • Type: org.apache.maven.project.MavenProject
  • Required: Yes
  • Expression: ${project}

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.)
  • Type: boolean
  • Required: No
  • Expression: ${maven.junit.quiet}
  • Default: true

reportsDirectory:

Base directory where all reports are written to.
  • Type: java.io.File
  • Required: No
  • Expression: ${project.build.directory}/surefire-reports

skipTests:

Set this to 'true' to skip running tests, but still compile them. Its use is NOT RECOMMENDED, but quite convenient on occasion.
  • Type: boolean
  • Required: No
  • Expression: ${skipTests}

systemProperties:

List of System properties to pass to the JUnit tests.
  • Type: java.util.Properties
  • Required: No

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
  • Type: java.lang.String
  • Required: No
  • Expression: ${test}

testFailureIgnore:

Set this to true to ignore a failure during testing. Its use is NOT RECOMMENDED, but quite convenient on occasion.
  • Type: boolean
  • Required: No
  • Expression: ${maven.test.failure.ignore}

timeout:

Abort the test if it doesn't complete in the given number of seconds. 0 means no timeout.
  • Type: int
  • Required: No
  • Expression: ${maven.junit.timeout}