failsafe:integration-test
Full name:
org.apache.maven.plugins:maven-failsafe-plugin:3.5.1:integration-test
Description:
Run integration tests using Surefire.
Attributes:
- Requires a Maven project to be executed.
- Requires dependency resolution of artifacts in scope:
test
. - The goal is thread-safe and supports parallel builds.
- Binds by default to the lifecycle phase:
integration-test
.
Required Parameters
Name | Type | Since | Description |
---|---|---|---|
<summaryFile> |
File |
- |
The summary file to write integration test results to. Default: ${project.build.directory}/failsafe-reports/failsafe-summary.xml |
Optional Parameters
Name | Type | Since | Description |
---|---|---|---|
<additionalClasspathDependencies> |
List<Dependency> |
3.2 |
Additional Maven dependencies to be added to the test classpath at runtime. Each element supports the parametrization like documented in POM Reference: Dependencies.
Those dependencies are automatically collected (i.e. have their full dependency tree calculated) and then all underlying artifacts are resolved from the repository (including their transitive dependencies). Afterwards the resolved artifacts are filtered to only contain The following differences to regular project dependency resolving apply:
User Property: maven.test.additionalClasspathDependencies |
<additionalClasspathElements> |
String[] |
2.4 |
Additional elements to be appended to the test classpath at runtime. Each element must be a file system path to a JAR file or a directory containing classes. No wildcards are allowed here. User Property: maven.test.additionalClasspath |
<argLine> |
String |
2.1 |
Arbitrary JVM options to set on the command line. Only effective for forked executions.
Since the Version 2.17 using an alternate syntax for argLine , @{...} allows late replacement of properties when the plugin is executed, so properties that have been modified by other plugins will be picked up correctly. See the Frequently Asked Questions page with more details:
http://maven.apache.org/surefire/maven-surefire-plugin/faq.html http://maven.apache.org/surefire/maven-failsafe-plugin/faq.html See also: forkCount User Property: argLine |
<childDelegation> |
boolean |
2.1 |
When false it makes tests run using the standard classloader delegation instead of the default Maven isolated classloader. Only used when forking (forkCount is greater than zero).
Setting it to false helps with some problems caused by conflicts between xml parsers in the classpath and the Java 5 provider parser. Default: false User Property: childDelegation |
<classesDirectory> |
File |
- |
The path representing project JAR file, if exists; Otherwise the directory containing generated classes of the project being tested. This will be included after the test classes in the test classpath. Defaults to built artifact JAR file or ${project.build.outputDirectory} . |
<classpathDependencyExcludes> |
String[] |
2.6 |
List of dependencies to exclude from the test classpath at runtime. Each item is passed as pattern to org.apache.maven.shared.artifact.filter.PatternIncludesArtifactFilter . The pattern is matched against the following artifact ids:
excludes pattern described there. The dependency matching is applied to the project dependency IDs (including transitive ones) after resolving, i.e. excluding one dependency will not exclude its transitive dependencies!User Property: maven.test.dependency.excludes |
<classpathDependencyScopeExclude> |
String |
2.6 |
A dependency scope to exclude from the test classpath at runtime. The scope should be one of the scopes defined by org.apache.maven.artifact.Artifact. This includes the following:
|
<consoleOutputReporter> |
SurefireConsoleOutputReporter |
- |
No description. |
<debugForkedProcess> |
String |
2.4 |
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 debugging ability options (without overwriting the other options specified through the argLine parameter).User Property: maven.failsafe.debug |
<dependenciesToScan> |
String[] |
2.15 |
List of dependencies to scan for test classes to include in the test run. The child elements of this element must be <dependency> elements, and the contents of each of these elements must be a string which follows the general form:
The wildcard character Examples:
Since version 2.22.0 you can scan for test classes from a project dependency of your multi-module project. In versions before 3.0.0-M4, only User Property: dependenciesToScan |
<disableXmlReport> |
Boolean |
2.2 |
Deprecated. Instead use disable within statelessTestsetReporter since of 3.0.0-M6.Flag to disable the generation of report files in xml format. Deprecated since 3.0.0-M4. Default: false User Property: disableXmlReport |
<enableAssertions> |
boolean |
2.3.1 |
By default, Surefire enables JVM assertions for the execution of your test cases. To disable the assertions, set this flag to "false". Default: true User Property: enableAssertions |
<enableOutErrElements> |
boolean |
3.3.1 |
Flag for including/excluding <system-out /> and <system-err /> elements for successfully passed tests in XML reports. Note that the default value may change to false is a future version.Default: true User Property: enableOutErrElements |
<enableProcessChecker> |
String |
3.0.0-M4 |
Since 3.0.0-M4 the process checkers are disabled. You can enable them namely by setting ping and native or all in this parameter.
The checker is useful in situations when you kill the build on a CI system and you want the Surefire forked JVM to kill the tests asap and free all handlers on the file system been previously used by the JVM and by the tests. The ping should be safely used together with ZGC or Shenandoah Garbage Collector. Due to the ping relies on timing of the PING (triggered every 30 seconds), slow GCs may pause the timers and pretend that the parent process of the forked JVM does not exist.
The native is very fast checker. It is useful mechanism on Unix based systems, Linux distributions and Alpine/BusyBox Linux. See the JIRA SUREFIRE-1631 for Windows issues.
Another useful configuration parameter is forkedProcessTimeoutInSeconds .
See the Frequently Asked Questions page with more details: http://maven.apache.org/surefire/maven-surefire-plugin/faq.html#kill-jvm http://maven.apache.org/surefire/maven-failsafe-plugin/faq.html#kill-jvm Example of use: mvn test -Dfailsafe.enableProcessChecker=all User Property: failsafe.enableProcessChecker |
<enablePropertiesElement> |
boolean |
3.3.1 |
Flag for including/excluding <properties /> element for successfully passed tests in XML reports.Default: true User Property: enablePropertiesElement |
<encoding> |
String |
3.0.0-M1 |
The character encoding scheme to be applied while generating test report files (see target/surefire-reports/yourTestName.txt). The report output files (*-out.txt) are still encoded with JVM's encoding used in standard out/err pipes. Default: ${project.reporting.outputEncoding} User Property: encoding |
<environmentVariables> |
Map<String,String> |
2.1.3 |
Additional environment variables to set on the command line. |
<excludeJUnit5Engines> |
String[] |
3.0.0-M6 |
Provide the ID/s of an JUnit engine to be excluded in the test run. User Property: failsafe.excludeJUnit5Engines |
<excludedEnvironmentVariables> |
String[] |
3.0.0-M4 |
You can selectively exclude individual environment variables by enumerating their keys.
The environment is a system-dependent mapping from keys to values which is inherited from the Maven process to the forked Surefire processes. The keys must literally (case sensitive) match in order to exclude their environment variable. Example to exclude three environment variables: mvn test -Dfailsafe.excludedEnvironmentVariables=ACME1,ACME2,ACME3 User Property: failsafe.excludedEnvironmentVariables |
<excludedGroups> |
String |
2.2 |
(TestNG/JUnit47 provider with JUnit4.8+ only and JUnit5+ provider since 2.22.0) Excluded groups/categories/tags. Any methods/classes/etc with one of the groups/categories/tags specified in this list will specifically not be run.
For JUnit4, this parameter forces the use of the 4.7 provider. For JUnit5, this parameter forces the use of the JUnit platform provider. This parameter is ignored if the suiteXmlFiles parameter is specified.
Since version 2.18.1 and JUnit 4.12, the @Category annotation type is automatically inherited from superclasses, see @java.lang.annotation.Inherited . Make sure that test class inheritance still makes sense together with @Category annotation of the JUnit 4.12 or higher appeared in superclass.User Property: excludedGroups |
<excludes> |
List<String> |
- |
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
(which excludes all inner classes).
This parameter is ignored if the TestNG suiteXmlFiles parameter is specified.
Each exclude item may also contain a comma-separated sub-list of items, which will be treated as multiple <exclude> entries. Since 2.19 a complex syntax is supported in one parameter (JUnit 4, JUnit 4.7+, TestNG):
Notice that these values are relative to the directory containing generated test classes of the project being tested. This directory is declared by the parameter testClassesDirectory which defaults to the POM property ${project.build.testOutputDirectory} , typically src/test/java unless overridden.User Property: failsafe.excludes |
<excludesFile> |
File |
2.13 |
A file containing exclude patterns, each in a next line. Blank lines, or lines starting with # are ignored. If excludes are also specified, these patterns are appended. Example with path, simple and regex excludes:
Since 3.0.0-M6, method filtering support is provided in the exclusions file as well, example:
User Property: failsafe.excludesFile |
<failIfNoSpecifiedTests> |
boolean |
3.0.0-M8 |
Set this to "false" to prevent a failure if none of the tests specified in -Dit.test=... are run. Defaults to "true". Replacing "it.failIfNoSpecifiedTests" to be consistent with surefire plugin. Default: true User Property: failsafe.failIfNoSpecifiedTests |
<failIfNoSpecifiedTestsDeprecated> |
boolean |
2.12 |
Deprecated. Since 3.0.0-M8, use "failsafe.failIfNoSpecifiedTests" instead. Set this to "false" to prevent a failure if none of the tests specified in -Dit.test=... are run. Defaults to "true". Default: true User Property: it.failIfNoSpecifiedTests |
<failIfNoTests> |
boolean |
2.4 |
Set this to "true" to cause a failure if there are no tests to run. Defaults to "false". Default: false User Property: failIfNoTests |
<forkCount> |
String |
2.14 |
Option to specify the number of VMs to fork in parallel in order to execute the tests. When terminated with "C", the number part is multiplied with the number of CPU cores. Floating point value are only accepted together with "C". If set to "0", no VM is forked and all tests are executed within the main process.
Example values: "1.5C", "4" The system properties and the argLine of the forked processes may contain the place holder string ${surefire.forkNumber} , which is replaced with a fixed number for each of the parallel forks, ranging from 1 to the effective value of forkCount times the maximum number of parallel Surefire executions in maven parallel builds, i.e. the effective value of the -T command line argument of maven core.Default: 1 User Property: forkCount |
<forkNode> |
ForkNodeFactory |
3.0.0-M5 |
This parameter configures the forked node. Currently, you can select the communication protocol, i.e. process pipes or TCP/IP sockets. The plugin uses process pipes by default which will be turned to TCP/IP in the version 3.0.0. Alternatively, you can implement your own factory and SPI.
See the documentation for more details: https://maven.apache.org/plugins/maven-surefire-plugin/examples/process-communication.html User Property: failsafe.forkNode |
<forkedProcessExitTimeoutInSeconds> |
int |
2.20 |
Forked process is normally terminated without any significant delay after given tests have completed. If the particular tests started non-daemon Thread(s), the process hangs instead of been properly terminated by System.exit() . Use this parameter in order to determine the timeout of terminating the process. see the documentation: http://maven.apache.org/surefire/maven-failsafe-plugin/examples/shutdown.htmlDefault: 30 User Property: failsafe.exitTimeout |
<forkedProcessTimeoutInSeconds> |
int |
2.4 |
Kill the forked test process after a certain number of seconds. If set to 0, wait forever for the process, never timing out. User Property: failsafe.timeout |
<groups> |
String |
2.2 |
(TestNG/JUnit47 provider with JUnit4.8+ only and JUnit5+ provider since 2.22.0) Groups/categories/tags for this test. Only classes/methods/etc decorated with one of the groups/categories/tags specified here will be included in test run, if specified.
For JUnit4 tests, this parameter forces the use of the 4.7 provider. For JUnit5 tests, this parameter forces the use of the JUnit platform provider. This parameter is ignored if the suiteXmlFiles parameter is specified.
Since version 2.18.1 and JUnit 4.12, the @Category annotation type is automatically inherited from superclasses, see @java.lang.annotation.Inherited . Make sure that test class inheritance still makes sense together with @Category annotation of the JUnit 4.12 or higher appeared in superclass.User Property: groups |
<includeJUnit5Engines> |
String[] |
3.0.0-M6 |
Provide the ID/s of an JUnit engine to be included in the test run. User Property: failsafe.includeJUnit5Engines |
<includes> |
List<String> |
- |
A list of <include> elements specifying the test filter (by pattern) of tests which should be included in testing. If it is not specified and the test parameter is unspecified as well, the default includes is
Each include item may also contain a comma-separated sublist of items, which will be treated as multiple <include> entries. Since 2.19 a complex syntax is supported in one parameter (JUnit 4, JUnit 4.7+, TestNG):
This parameter is ignored if the TestNG suiteXmlFiles parameter is specified.
Notice that these values are relative to the directory containing generated test classes of the project being tested. This directory is declared by the parameter testClassesDirectory which defaults to the POM property ${project.build.testOutputDirectory} , typically src/test/java unless overridden.User Property: failsafe.includes |
<includesFile> |
File |
2.13 |
A file containing include patterns, each in a next line. Blank lines, or lines starting with # are ignored. If includes are also specified, these patterns are appended. Example with path, simple and regex includes:
Since 3.0.0-M6, method filtering support is provided in the inclusions file as well, example:
User Property: failsafe.includesFile |
<jdkToolchain> |
Map<String,String> |
3.0.0-M5 and Maven 3.3.x |
Allow for configuration of the test jvm via maven toolchains. This permits a configuration where the project is built with one jvm and tested with another. This is similar to Examples: (see Guide to Toolchains for more info)
|
<junitArtifactName> |
String |
2.3.1 |
Allows you to specify the name of the JUnit artifact. If not set, junit:junit will be used.Default: junit:junit User Property: junitArtifactName |
<jvm> |
String |
2.1 |
Option to specify the jvm (or path to the java executable) to use with the forking options. For the default, the jvm will be a new instance of the same VM as the one used to run Maven. JVM settings are not inherited from MAVEN_OPTS. User Property: jvm |
<objectFactory> |
String |
2.5 |
(TestNG only) Define the factory class used to create all test instances. User Property: objectFactory |
<parallel> |
String |
2.2 |
(TestNG provider) When you use the parameter parallel , TestNG will try to run all your test methods in separate threads, except for methods that depend on each other, which will be run in the same thread in order to respect their order of execution. Supports two values: classes or methods .
(JUnit 4.7 provider) Supports values classes , methods , both to run in separate threads been controlled by threadCount .
Since version 2.16 (JUnit 4.7 provider), the value both is DEPRECATED. Use classesAndMethods instead.
Since version 2.16 (JUnit 4.7 provider), additional vales are available: suites , suitesAndClasses , suitesAndMethods , classesAndMethods , all .
By default, Surefire does not execute tests in parallel. You can set the parameter parallel to none to explicitly disable parallel execution (e.g. when disabling parallel execution in special Maven profiles when executing coverage analysis).User Property: parallel |
<parallelOptimized> |
boolean |
2.17 |
(JUnit 4.7 / provider only) The thread counts do not exceed the number of parallel suite, class runners and average number of methods per class if set to true.
True by default. Default: true User Property: parallelOptimized |
<parallelTestsTimeoutForcedInSeconds> |
double |
2.16 |
Stop executing queued parallel JUnit tests and interrupt currently running tests after a certain number of seconds.
Example values: "3.5", "4" If set to 0, wait forever, never timing out. Makes sense with specified parallel different from "none".User Property: failsafe.parallel.forcedTimeout |
<parallelTestsTimeoutInSeconds> |
double |
2.16 |
Stop executing queued parallel JUnit tests after a certain number of seconds.
Example values: "3.5", "4" If set to 0, wait forever, never timing out. Makes sense with specified parallel different from "none".User Property: failsafe.parallel.timeout |
<perCoreThreadCount> |
boolean |
2.5 |
(JUnit 4.7 provider) Indicates that threadCount, threadCountSuites, threadCountClasses, threadCountMethods are per cpu core. Default: true User Property: perCoreThreadCount |
<printSummary> |
boolean |
- |
Option to print summary of test suites or just print the test cases that have errors. Default: true User Property: failsafe.printSummary |
<promoteUserPropertiesToSystemProperties> |
boolean |
3.4.0 |
If set to true will also pass all user properties exposed via org.apache.maven.execution.MavenSession.getUserProperties() as system properties to a provider. Those always take precedence over same named system properties set via any other means.See also: systemPropertyVariables Default: true |
<properties> |
Properties |
2.4 |
List of properties for configuring the testing provider. This is the preferred method of configuring TestNG and JUnit platform providers.
JUnit platform properties may be defined in a configurationParameters element:
TestNG properties may be defined as distinct element blocks:
|
<redirectTestOutputToFile> |
boolean |
2.3 |
Set this to "true" to redirect the unit test standard output to a file (found in reportsDirectory/testName-output.txt). Default: false User Property: maven.test.redirectTestOutputToFile |
<reportFormat> |
String |
- |
Selects the formatting for the test report to be generated. Can be set as "brief" or "plain". Only applies to the output format of the output files (target/surefire-reports/testName.txt) Default: brief User Property: failsafe.reportFormat |
<reportNameSuffix> |
String |
- |
Add custom text into report filename: TEST-testClassName-reportNameSuffix.xml, testClassName-reportNameSuffix.txt and testClassName-reportNameSuffix-output.txt. File TEST-testClassName-reportNameSuffix.xml has changed attributes 'testsuite'--'name' and 'testcase'--'classname' - reportNameSuffix is added to the attribute value. User Property: surefire.reportNameSuffix |
<reportsDirectory> |
File |
- |
Base directory where all reports are written to. Default: ${project.build.directory}/failsafe-reports |
<rerunFailingTestsCount> |
int |
- |
(JUnit 4+ providers and JUnit 5+ providers since 3.0.0-M4) The number of times each failing test will be rerun. If set larger than 0, rerun failing tests immediately after they fail. If a failing test passes in any of those reruns, it will be marked as pass and reported as a "flake". However, all the failing attempts will be recorded. Default: 0 User Property: failsafe.rerunFailingTestsCount |
<reuseForks> |
boolean |
2.13 |
Indicates if forked VMs can be reused. If set to "false", a new VM is forked for each test class to be executed. If set to "true", up to forkCount VMs will be forked and then reused to execute all tests.Default: true User Property: reuseForks |
<runOrder> |
String |
2.7 |
Defines the order the tests will be run in. Supported values are alphabetical , reversealphabetical , random , hourly (alphabetical on even hours, reverse alphabetical on odd hours), failedfirst , balanced and filesystem .
Odd/Even for hourly is determined at the time the of scanning the classpath, meaning it could change during a multi-module build. Failed first will run tests that failed on previous run first, as well as new tests for this run. Balanced is only relevant with parallel=classes, and will try to optimize the run-order of the tests reducing the overall execution time. Initially a statistics file is created and every next test run will reorder classes. Note that the statistics are stored in a file named .surefire-XXXXXXXXX beside pom.xml and should not be checked into version control. The "XXXXX" is the SHA1 checksum of the entire surefire configuration, so different configurations will have different statistics files, meaning if you change any configuration settings you will re-run once before new statistics data can be established. Default: filesystem User Property: failsafe.runOrder |
<runOrderRandomSeed> |
Long |
3.0.0-M6 |
Sets the random seed that will be used to order the tests if failsafe.runOrder is set to random .
If no seeds are set and failsafe.runOrder is set to random , then the seed used will be outputted (search for "To reproduce ordering use flag -Dfailsafe.runOrder.random.seed").
To deterministically reproduce any random test order that was run before, simply set the seed to be the same value. User Property: failsafe.runOrder.random.seed |
<shutdown> |
String |
2.19 |
After the plugin process is shutdown by sending SIGTERM signal (CTRL+C), SHUTDOWN command is received by every forked JVM.
The value is set to ( shutdown=exit ) by default (changed in version 3.0.0-M4).
The parameter can be configured with other two values testset and kill .
With( shutdown=testset ) the test set may still continue to run in forked JVM.
Using exit forked JVM executes System.exit(1) after the plugin process has received SIGTERM signal.
Using kill the JVM executes Runtime.halt(1) and kills itself.Default: exit User Property: failsafe.shutdown |
<skip> |
boolean |
- |
Set this to "true" to bypass unit tests entirely. Its use is NOT RECOMMENDED, especially if you enable it using the "maven.test.skip" property, because maven.test.skip disables both running the tests and compiling the tests. Consider using the skipTests parameter instead.Default: false User Property: maven.test.skip |
<skipAfterFailureCount> |
int |
2.19 |
Set to error/failure count in order to skip remaining tests. Due to race conditions in parallel/forked execution this may not be fully guaranteed.
Enable with system property -Dfailsafe.skipAfterFailureCount=1 or any number greater than zero. Defaults to "0".
See the prerequisites and limitations in documentation: http://maven.apache.org/plugins/maven-failsafe-plugin/examples/skip-after-failure.html Default: 0 User Property: failsafe.skipAfterFailureCount |
<skipExec> |
boolean |
2.3 |
Deprecated. Use skipTests instead. This old parameter is just like skipTests , but bound to the old property "maven.test.skip.exec".User Property: maven.test.skip.exec |
<skipITs> |
boolean |
2.4.3-alpha-2 |
Set this to "true" to skip running integration tests, but still compile them. Its use is NOT RECOMMENDED, but quite convenient on occasion. User Property: skipITs |
<skipTests> |
boolean |
2.4 |
Set this to "true" to skip running tests, but still compile them. Its use is NOT RECOMMENDED, but quite convenient on occasion.
Failsafe plugin deprecated the parameter skipTests and the parameter will be removed in Failsafe 3.0.0 as it is a source of conflicts between Failsafe and Surefire plugin.Default: false User Property: skipTests |
<statelessTestsetInfoReporter> |
SurefireStatelessTestsetInfoReporter |
- |
No description. |
<statelessTestsetReporter> |
SurefireStatelessReporter |
- |
No description. |
<suiteXmlFiles> |
File[] |
2.2 |
(TestNG) List of <suiteXmlFile> elements specifying TestNG suite xml file locations. Note that suiteXmlFiles is incompatible with several other parameters of this plugin, like includes and excludes .
This parameter is ignored if the test parameter is specified (allowing you to run a single test instead of an entire suite).User Property: failsafe.suiteXmlFiles |
<systemProperties> |
Properties |
- |
Deprecated. Use systemPropertyVariables instead.List of System properties to pass to a provider. See also: systemPropertyVariables for how the effective provider properties are calculated |
<systemPropertiesFile> |
File |
- |
Properties file being used as system properties passed to the provider. See also: systemPropertyVariables for how the effective provider properties are calculatedUser Property: failsafe.systemPropertiesFile |
<systemPropertyVariables> |
Map<String,String> |
2.5 |
List of System properties to pass to a provider. The effective system properties given to a provider are contributed from several sources:
systemProperties , getSystemPropertiesFile() or systemPropertyVariables .
Certain properties may only be overwritten via
See also: systemProperties |
<tempDir> |
String |
2.20 |
Relative path to temporary-surefire-boot directory containing internal Surefire temporary files.
The temporary-surefire-boot directory is project.build.directory on most platforms or system default temporary-directory specified by the system property java.io.tmpdir on Windows (see SUREFIRE-1400).
It is deleted after the test set has completed. Default: surefire User Property: tempDir |
<test> |
String |
- |
Specify this parameter to run individual tests by file name, overriding parameter includes and excludes . Each pattern you specify here will be used to create an include pattern formatted like **/${it.test}.java , so you can just type -Dit.test=MyIT to run a single test file called "foo/MyIT.java". The test patterns prefixed with a ! will be excluded.
This parameter overrides the parameter includes and excludes , and the TestNG parameter suiteXmlFiles .
Since 2.7.3 You can execute a limited number of methods in the test with adding #myMethod or #my*ethod. E.g. type -Dit.test=MyIT#myMethod supported for junit 4.x and TestNg.
Since 2.19 a complex syntax is supported in one parameter (JUnit 4, JUnit 4.7+, TestNG): or e.g.
The Parameterized JUnit runner describes test methods using an index in brackets, so the non-regex method pattern would become: #testMethod[*] . If using @Parameters(name="{index}: fib({0})={1}") and selecting the index e.g. 5 in pattern, the non-regex method pattern would become #testMethod[5:*] .User Property: it.test |
<testClassesDirectory> |
File |
- |
The directory containing generated test classes of the project being tested. This will be included at the beginning of the test classpath. Default: ${project.build.testOutputDirectory} |
<testNGArtifactName> |
String |
2.3.1 |
Allows you to specify the name of the TestNG artifact. If not set, org.testng:testng will be used.Default: org.testng:testng User Property: testNGArtifactName |
<testSourceDirectory> |
File |
2.2 |
The test source directory containing test class sources. Important only for TestNG HTML reports. Default: ${project.build.testSourceDirectory} |
<threadCount> |
int |
2.2 |
(TestNG/JUnit 4.7 provider) The attribute thread-count allows you to specify how many threads should be allocated for this execution. Only makes sense to use in conjunction with the parallel parameter.User Property: threadCount |
<threadCountClasses> |
int |
2.16 |
(JUnit 4.7 provider) This attribute allows you to specify the concurrency in test classes, i.e.:
parallel parameter. The default value 0 behaves same as unspecified one.Default: 0 User Property: threadCountClasses |
<threadCountMethods> |
int |
2.16 |
(JUnit 4.7 provider) This attribute allows you to specify the concurrency in test methods, i.e.:
parallel parameter. The default value 0 behaves same as unspecified one.Default: 0 User Property: threadCountMethods |
<threadCountSuites> |
int |
2.16 |
(JUnit 4.7 provider) This attribute allows you to specify the concurrency in test suites, i.e.:
parallel parameter. The default value 0 behaves same as unspecified one.Default: 0 User Property: threadCountSuites |
<trimStackTrace> |
boolean |
2.2 |
Whether to trim the stack trace in the reports to just the lines within the test, or show the full trace. Default: false User Property: trimStackTrace |
<useFile> |
boolean |
- |
Option to generate a file test report or just output the test report to the console. Default: true User Property: failsafe.useFile |
<useManifestOnlyJar> |
boolean |
2.4.3 |
By default, Surefire forks your tests using a manifest-only JAR; set this parameter to "false" to force it to launch your tests with a plain old Java classpath. (See the http://maven.apache.org/plugins/maven-failsafe-plugin/examples/class-loading.html for a more detailed explanation of manifest-only JARs and their benefits.)
Beware, setting this to "false" may cause your tests to fail on Windows if your classpath is too long. Default: true User Property: failsafe.useManifestOnlyJar |
<useModulePath> |
boolean |
3.0.0-M2 |
When true , uses the modulepath when executing with JDK 9+ and module-info.java is present. When false , always uses the classpath.
Defaults to true .Default: true User Property: failsafe.useModulePath |
<useSystemClassLoader> |
boolean |
2.3 |
Option to pass dependencies to the system's classloader instead of using an isolated class loader when forking. Prevents problems with JDKs which implement the service provider lookup mechanism by using the system's classloader. Default: true User Property: failsafe.useSystemClassLoader |
<useUnlimitedThreads> |
boolean |
2.5 |
(JUnit 4.7 provider) Indicates that the thread pool will be unlimited. The parallel parameter and the actual number of classes/methods will decide. Setting this to "true" effectively disables perCoreThreadCount and threadCount . Defaults to "false".Default: false User Property: useUnlimitedThreads |
<workingDirectory> |
File |
2.1.3 |
Command line working directory. User Property: basedir |
Parameter Details
<additionalClasspathDependencies>
Those dependencies are automatically collected (i.e. have their full dependency tree calculated) and then all underlying artifacts are resolved from the repository (including their transitive dependencies). Afterwards the resolved artifacts are filtered to only contain compile
and runtime
scoped ones and appended to the test classpath at runtime (after the ones from additionalClasspathElements
).
The following differences to regular project dependency resolving apply:
- The dependency management from the project is not taken into account.
- Conflicts between the different items and the project dependencies are not resolved.
- Only external dependencies (outside the current Maven reactor) are supported.
- Type:
java.util.List<org.apache.maven.model.Dependency>
- Since:
3.2
- Required:
No
- User Property:
maven.test.additionalClasspathDependencies
<additionalClasspathElements>
- Type:
java.lang.String[]
- Since:
2.4
- Required:
No
- User Property:
maven.test.additionalClasspath
<argLine>
Since the Version 2.17 using an alternate syntax for
argLine
, @{...} allows late replacement of properties when the plugin is executed, so properties that have been modified by other plugins will be picked up correctly. See the Frequently Asked Questions page with more details:
http://maven.apache.org/surefire/maven-surefire-plugin/faq.html
http://maven.apache.org/surefire/maven-failsafe-plugin/faq.html
See also: forkCount
- Type:
java.lang.String
- Since:
2.1
- Required:
No
- User Property:
argLine
<childDelegation>
forkCount
is greater than zero).
Setting it to false helps with some problems caused by conflicts between xml parsers in the classpath and the Java 5 provider parser.
- Type:
boolean
- Since:
2.1
- Required:
No
- User Property:
childDelegation
- Default:
false
<classesDirectory>
${project.build.outputDirectory}
.- Type:
java.io.File
- Required:
No
<classpathDependencyExcludes>
org.apache.maven.shared.artifact.filter.PatternIncludesArtifactFilter
. The pattern is matched against the following artifact ids:
groupId:artifactId
(Short ID)groupId:artifactId:type:classifier
(Dependency Conflict ID)groupId:artifactId:type:classifier:version
(Full ID)
excludes
pattern described there. The dependency matching is applied to the project dependency IDs (including transitive ones) after resolving, i.e. excluding one dependency will not exclude its transitive dependencies!- Type:
java.lang.String[]
- Since:
2.6
- Required:
No
- User Property:
maven.test.dependency.excludes
<classpathDependencyScopeExclude>
- compile - system, provided, compile
- runtime - compile, runtime
- compile+runtime - system, provided, compile, runtime
- runtime+system - system, compile, runtime
- test - system, provided, compile, runtime, test
- Type:
java.lang.String
- Since:
2.6
- Required:
No
<consoleOutputReporter>
- Type:
org.apache.maven.plugin.surefire.extensions.SurefireConsoleOutputReporter
- Required:
No
<debugForkedProcess>
argLine
parameter).- Type:
java.lang.String
- Since:
2.4
- Required:
No
- User Property:
maven.failsafe.debug
<dependenciesToScan>
groupId[:artifactId[:type[:classifier][:version]]]
The wildcard character *
can be used within the sub parts of those composite identifiers to do glob-like pattern matching. The classifier may be omitted when matching dependencies without a classifier.
Examples:
group
or, equivalently,group:*
g*p:*rtifac*
group:*:jar
group:artifact:*:1.0.0
(no classifier)group:*:test-jar:tests
*:artifact:*:*:1.0.0
Since version 2.22.0 you can scan for test classes from a project dependency of your multi-module project.
In versions before 3.0.0-M4, only groupId:artifactId
is supported.
- Type:
java.lang.String[]
- Since:
2.15
- Required:
No
- User Property:
dependenciesToScan
<disableXmlReport>
Instead use disable within
statelessTestsetReporter
since of 3.0.0-M6.- Type:
java.lang.Boolean
- Since:
2.2
- Required:
No
- User Property:
disableXmlReport
- Default:
false
<enableAssertions>
- Type:
boolean
- Since:
2.3.1
- Required:
No
- User Property:
enableAssertions
- Default:
true
<enableOutErrElements>
<system-out />
and <system-err />
elements for successfully passed tests in XML reports. Note that the default value may change to false
is a future version.- Type:
boolean
- Since:
3.3.1
- Required:
No
- User Property:
enableOutErrElements
- Default:
true
<enableProcessChecker>
ping
and native
or all
in this parameter.
The checker is useful in situations when you kill the build on a CI system and you want the Surefire forked JVM to kill the tests asap and free all handlers on the file system been previously used by the JVM and by the tests.
The
ping
should be safely used together with ZGC or Shenandoah Garbage Collector. Due to the ping
relies on timing of the PING (triggered every 30 seconds), slow GCs may pause the timers and pretend that the parent process of the forked JVM does not exist.
The
native
is very fast checker. It is useful mechanism on Unix based systems, Linux distributions and Alpine/BusyBox Linux. See the JIRA SUREFIRE-1631 for Windows issues.
Another useful configuration parameter is
forkedProcessTimeoutInSeconds
.
See the Frequently Asked Questions page with more details:
http://maven.apache.org/surefire/maven-surefire-plugin/faq.html#kill-jvm
http://maven.apache.org/surefire/maven-failsafe-plugin/faq.html#kill-jvm
Example of use:
mvn test -Dfailsafe.enableProcessChecker=all
- Type:
java.lang.String
- Since:
3.0.0-M4
- Required:
No
- User Property:
failsafe.enableProcessChecker
<enablePropertiesElement>
<properties />
element for successfully passed tests in XML reports.- Type:
boolean
- Since:
3.3.1
- Required:
No
- User Property:
enablePropertiesElement
- Default:
true
<encoding>
- Type:
java.lang.String
- Since:
3.0.0-M1
- Required:
No
- User Property:
encoding
- Default:
${project.reporting.outputEncoding}
<environmentVariables>
- Type:
java.util.Map<java.lang.String, java.lang.String>
- Since:
2.1.3
- Required:
No
<excludeJUnit5Engines>
- Type:
java.lang.String[]
- Since:
3.0.0-M6
- Required:
No
- User Property:
failsafe.excludeJUnit5Engines
<excludedEnvironmentVariables>
The environment is a system-dependent mapping from keys to values which is inherited from the Maven process to the forked Surefire processes. The keys must literally (case sensitive) match in order to exclude their environment variable.
Example to exclude three environment variables:
mvn test -Dfailsafe.excludedEnvironmentVariables=ACME1,ACME2,ACME3
- Type:
java.lang.String[]
- Since:
3.0.0-M4
- Required:
No
- User Property:
failsafe.excludedEnvironmentVariables
<excludedGroups>
For JUnit4, this parameter forces the use of the 4.7 provider. For JUnit5, this parameter forces the use of the JUnit platform provider.
This parameter is ignored if the
suiteXmlFiles
parameter is specified.
Since version 2.18.1 and JUnit 4.12, the
@Category
annotation type is automatically inherited from superclasses, see @java.lang.annotation.Inherited
. Make sure that test class inheritance still makes sense together with @Category
annotation of the JUnit 4.12 or higher appeared in superclass.- Type:
java.lang.String
- Since:
2.2
- Required:
No
- User Property:
excludedGroups
<excludes>
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.
Each exclude item may also contain a comma-separated sub-list of items, which will be treated as multiple <exclude> entries.
Since 2.19 a complex syntax is supported in one parameter (JUnit 4, JUnit 4.7+, TestNG):
<exclude>%regex[pkg.*Slow.*.class], Unstable*</exclude>
Notice that these values are relative to the directory containing generated test classes of the project being tested. This directory is declared by the parameter
testClassesDirectory
which defaults to the POM property ${project.build.testOutputDirectory}
, typically src/test/java
unless overridden.- Type:
java.util.List<java.lang.String>
- Required:
No
- User Property:
failsafe.excludes
<excludesFile>
excludes
are also specified, these patterns are appended. Example with path, simple and regex excludes:
*/it/*
**/DontRunIT.*
%regex[.*IT.*|.*Not.*]
Since 3.0.0-M6, method filtering support is provided in the exclusions file as well, example:
pkg.SomeIT#testMethod
- Type:
java.io.File
- Since:
2.13
- Required:
No
- User Property:
failsafe.excludesFile
<failIfNoSpecifiedTests>
- Type:
boolean
- Since:
3.0.0-M8
- Required:
No
- User Property:
failsafe.failIfNoSpecifiedTests
- Default:
true
<failIfNoSpecifiedTestsDeprecated>
Since 3.0.0-M8, use "failsafe.failIfNoSpecifiedTests" instead.
- Type:
boolean
- Since:
2.12
- Required:
No
- User Property:
it.failIfNoSpecifiedTests
- Default:
true
<failIfNoTests>
- Type:
boolean
- Since:
2.4
- Required:
No
- User Property:
failIfNoTests
- Default:
false
<forkCount>
Example values: "1.5C", "4"
The system properties and the
argLine
of the forked processes may contain the place holder string ${surefire.forkNumber}
, which is replaced with a fixed number for each of the parallel forks, ranging from 1 to the effective value of forkCount
times the maximum number of parallel Surefire executions in maven parallel builds, i.e. the effective value of the -T command line argument of maven core.- Type:
java.lang.String
- Since:
2.14
- Required:
No
- User Property:
forkCount
- Default:
1
<forkNode>
See the documentation for more details:
https://maven.apache.org/plugins/maven-surefire-plugin/examples/process-communication.html
- Type:
org.apache.maven.surefire.extensions.ForkNodeFactory
- Since:
3.0.0-M5
- Required:
No
- User Property:
failsafe.forkNode
<forkedProcessExitTimeoutInSeconds>
System.exit()
. Use this parameter in order to determine the timeout of terminating the process. see the documentation: http://maven.apache.org/surefire/maven-failsafe-plugin/examples/shutdown.html- Type:
int
- Since:
2.20
- Required:
No
- User Property:
failsafe.exitTimeout
- Default:
30
<forkedProcessTimeoutInSeconds>
- Type:
int
- Since:
2.4
- Required:
No
- User Property:
failsafe.timeout
<groups>
For JUnit4 tests, this parameter forces the use of the 4.7 provider. For JUnit5 tests, this parameter forces the use of the JUnit platform provider.
This parameter is ignored if the
suiteXmlFiles
parameter is specified.
Since version 2.18.1 and JUnit 4.12, the
@Category
annotation type is automatically inherited from superclasses, see @java.lang.annotation.Inherited
. Make sure that test class inheritance still makes sense together with @Category
annotation of the JUnit 4.12 or higher appeared in superclass.- Type:
java.lang.String
- Since:
2.2
- Required:
No
- User Property:
groups
<includeJUnit5Engines>
- Type:
java.lang.String[]
- Since:
3.0.0-M6
- Required:
No
- User Property:
failsafe.includeJUnit5Engines
<includes>
test
parameter is unspecified as well, the default includes is
<includes>
<include>**/IT*.java</include>
<include>**/*IT.java</include>
<include>**/*ITCase.java</include>
</includes>
Each include item may also contain a comma-separated sublist of items, which will be treated as multiple <include> entries.
Since 2.19 a complex syntax is supported in one parameter (JUnit 4, JUnit 4.7+, TestNG):
<include>%regex[.*[Cat|Dog].*], Basic????, !Unstable*</include>
<include>%regex[.*[Cat|Dog].*], !%regex[pkg.*Slow.*.class], pkg/**/*Fast*.java</include>
This parameter is ignored if the TestNG
suiteXmlFiles
parameter is specified.
Notice that these values are relative to the directory containing generated test classes of the project being tested. This directory is declared by the parameter
testClassesDirectory
which defaults to the POM property ${project.build.testOutputDirectory}
, typically src/test/java
unless overridden.- Type:
java.util.List<java.lang.String>
- Required:
No
- User Property:
failsafe.includes
<includesFile>
includes
are also specified, these patterns are appended. Example with path, simple and regex includes:
*/it/*
**/NotIncludedByDefault.java
%regex[.*IT.*|.*Not.*]
Since 3.0.0-M6, method filtering support is provided in the inclusions file as well, example:
pkg.SomeIT#testMethod
- Type:
java.io.File
- Since:
2.13
- Required:
No
- User Property:
failsafe.includesFile
<jdkToolchain>
Allow for configuration of the test jvm via maven toolchains. This permits a configuration where the project is built with one jvm and tested with another. This is similar to jvm
, but avoids hardcoding paths. The two parameters are mutually exclusive (jvm wins)
Examples:
(see Guide to Toolchains for more info)
<configuration>
...
<jdkToolchain>
<version>1.11</version>
</jdkToolchain>
</configuration>
<configuration>
...
<jdkToolchain>
<version>1.8</version>
<vendor>zulu</vendor>
</jdkToolchain>
</configuration>
- Type:
java.util.Map<java.lang.String, java.lang.String>
- Since:
3.0.0-M5 and Maven 3.3.x
- Required:
No
<junitArtifactName>
junit:junit
will be used.- Type:
java.lang.String
- Since:
2.3.1
- Required:
No
- User Property:
junitArtifactName
- Default:
junit:junit
<jvm>
- Type:
java.lang.String
- Since:
2.1
- Required:
No
- User Property:
jvm
<objectFactory>
- Type:
java.lang.String
- Since:
2.5
- Required:
No
- User Property:
objectFactory
<parallel>
parallel
, TestNG will try to run all your test methods in separate threads, except for methods that depend on each other, which will be run in the same thread in order to respect their order of execution. Supports two values: classes
or methods
.
(JUnit 4.7 provider) Supports values
classes
, methods
, both
to run in separate threads been controlled by threadCount
.
Since version 2.16 (JUnit 4.7 provider), the value
both
is DEPRECATED. Use classesAndMethods
instead.
Since version 2.16 (JUnit 4.7 provider), additional vales are available:
suites
, suitesAndClasses
, suitesAndMethods
, classesAndMethods
, all
.
By default, Surefire does not execute tests in parallel. You can set the parameter
parallel
to none
to explicitly disable parallel execution (e.g. when disabling parallel execution in special Maven profiles when executing coverage analysis).- Type:
java.lang.String
- Since:
2.2
- Required:
No
- User Property:
parallel
<parallelOptimized>
True by default.
- Type:
boolean
- Since:
2.17
- Required:
No
- User Property:
parallelOptimized
- Default:
true
<parallelTestsTimeoutForcedInSeconds>
Example values: "3.5", "4"
If set to 0, wait forever, never timing out. Makes sense with specified
parallel
different from "none".- Type:
double
- Since:
2.16
- Required:
No
- User Property:
failsafe.parallel.forcedTimeout
<parallelTestsTimeoutInSeconds>
Example values: "3.5", "4"
If set to 0, wait forever, never timing out. Makes sense with specified
parallel
different from "none".- Type:
double
- Since:
2.16
- Required:
No
- User Property:
failsafe.parallel.timeout
<perCoreThreadCount>
- Type:
boolean
- Since:
2.5
- Required:
No
- User Property:
perCoreThreadCount
- Default:
true
<printSummary>
- Type:
boolean
- Required:
No
- User Property:
failsafe.printSummary
- Default:
true
<promoteUserPropertiesToSystemProperties>
true
will also pass all user properties exposed via org.apache.maven.execution.MavenSession.getUserProperties()
as system properties to a provider. Those always take precedence over same named system properties set via any other means.See also: systemPropertyVariables
- Type:
boolean
- Since:
3.4.0
- Required:
No
- Default:
true
<properties>
JUnit platform properties may be defined in a
configurationParameters
element:
<properties>
<configurationParameters>
junit.jupiter.execution.parallel.enabled = true
junit.jupiter.execution.parallel.mode.default = concurrent
</configurationParameters>
</properties>
TestNG properties may be defined as distinct element blocks:
<properties>
<property>
<name>parallel</name>
<value>methods</value>
</property>
</properties>
- Type:
java.util.Properties
- Since:
2.4
- Required:
No
<redirectTestOutputToFile>
- Type:
boolean
- Since:
2.3
- Required:
No
- User Property:
maven.test.redirectTestOutputToFile
- Default:
false
<reportFormat>
- Type:
java.lang.String
- Required:
No
- User Property:
failsafe.reportFormat
- Default:
brief
<reportNameSuffix>
- Type:
java.lang.String
- Required:
No
- User Property:
surefire.reportNameSuffix
<reportsDirectory>
- Type:
java.io.File
- Required:
No
- Default:
${project.build.directory}/failsafe-reports
<rerunFailingTestsCount>
- Type:
int
- Required:
No
- User Property:
failsafe.rerunFailingTestsCount
- Default:
0
<reuseForks>
forkCount
VMs will be forked and then reused to execute all tests.- Type:
boolean
- Since:
2.13
- Required:
No
- User Property:
reuseForks
- Default:
true
<runOrder>
alphabetical
, reversealphabetical
, random
, hourly
(alphabetical on even hours, reverse alphabetical on odd hours), failedfirst
, balanced
and filesystem
.
Odd/Even for hourly is determined at the time the of scanning the classpath, meaning it could change during a multi-module build.
Failed first will run tests that failed on previous run first, as well as new tests for this run.
Balanced is only relevant with parallel=classes, and will try to optimize the run-order of the tests reducing the overall execution time. Initially a statistics file is created and every next test run will reorder classes.
Note that the statistics are stored in a file named .surefire-XXXXXXXXX beside pom.xml and should not be checked into version control. The "XXXXX" is the SHA1 checksum of the entire surefire configuration, so different configurations will have different statistics files, meaning if you change any configuration settings you will re-run once before new statistics data can be established.
- Type:
java.lang.String
- Since:
2.7
- Required:
No
- User Property:
failsafe.runOrder
- Default:
filesystem
<runOrderRandomSeed>
failsafe.runOrder
is set to random
.
If no seeds are set and
failsafe.runOrder
is set to random
, then the seed used will be outputted (search for "To reproduce ordering use flag -Dfailsafe.runOrder.random.seed").
To deterministically reproduce any random test order that was run before, simply set the seed to be the same value.
- Type:
java.lang.Long
- Since:
3.0.0-M6
- Required:
No
- User Property:
failsafe.runOrder.random.seed
<shutdown>
The value is set to (
shutdown=exit
) by default (changed in version 3.0.0-M4).
The parameter can be configured with other two values
testset
and kill
.
With(
shutdown=testset
) the test set may still continue to run in forked JVM.
Using
exit
forked JVM executes System.exit(1)
after the plugin process has received SIGTERM signal.
Using
kill
the JVM executes Runtime.halt(1)
and kills itself.- Type:
java.lang.String
- Since:
2.19
- Required:
No
- User Property:
failsafe.shutdown
- Default:
exit
<skip>
skipTests
parameter instead.- Type:
boolean
- Required:
No
- User Property:
maven.test.skip
- Default:
false
<skipAfterFailureCount>
Enable with system property
-Dfailsafe.skipAfterFailureCount=1
or any number greater than zero. Defaults to "0".
See the prerequisites and limitations in documentation:
http://maven.apache.org/plugins/maven-failsafe-plugin/examples/skip-after-failure.html
- Type:
int
- Since:
2.19
- Required:
No
- User Property:
failsafe.skipAfterFailureCount
- Default:
0
<skipExec>
Use skipTests instead.
skipTests
, but bound to the old property "maven.test.skip.exec".- Type:
boolean
- Since:
2.3
- Required:
No
- User Property:
maven.test.skip.exec
<skipITs>
- Type:
boolean
- Since:
2.4.3-alpha-2
- Required:
No
- User Property:
skipITs
<skipTests>
Failsafe plugin deprecated the parameter
skipTests
and the parameter will be removed in Failsafe 3.0.0 as it is a source of conflicts between Failsafe and Surefire plugin.- Type:
boolean
- Since:
2.4
- Required:
No
- User Property:
skipTests
- Default:
false
<statelessTestsetInfoReporter>
- Type:
org.apache.maven.plugin.surefire.extensions.SurefireStatelessTestsetInfoReporter
- Required:
No
<statelessTestsetReporter>
- Type:
org.apache.maven.plugin.surefire.extensions.SurefireStatelessReporter
- Required:
No
<suiteXmlFiles>
suiteXmlFiles
is incompatible with several other parameters of this plugin, like includes
and excludes
.
This parameter is ignored if the
test
parameter is specified (allowing you to run a single test instead of an entire suite).- Type:
java.io.File[]
- Since:
2.2
- Required:
No
- User Property:
failsafe.suiteXmlFiles
<summaryFile>
- Type:
java.io.File
- Required:
Yes
- Default:
${project.build.directory}/failsafe-reports/failsafe-summary.xml
<systemProperties>
Use
systemPropertyVariables
instead.See also:
systemPropertyVariables
for how the effective provider properties are calculated- Type:
java.util.Properties
- Required:
No
<systemPropertiesFile>
See also:
systemPropertyVariables
for how the effective provider properties are calculated- Type:
java.io.File
- Required:
No
- User Property:
failsafe.systemPropertiesFile
<systemPropertyVariables>
- properties set via
argLine
with-D
(only for forked executions) systemProperties
getSystemPropertiesFile()
(set via parametersystemPropertiesFile
on some goals)systemPropertyVariables
- User properties from
org.apache.maven.execution.MavenSession.getUserProperties()
, usually set via CLI options given with-D
on the current Maven process (only used as source ifpromoteUserPropertiesToSystemProperties
istrue
)
systemProperties
, getSystemPropertiesFile()
or systemPropertyVariables
.
Certain properties may only be overwritten via argLine
(applicable only for forked executions) because their values are cached and only evaluated at the start of the JRE. Those include:
java.library.path
file.encoding
jdk.map.althashing.threshold
line.separator
See also: systemProperties
- Type:
java.util.Map<java.lang.String, java.lang.String>
- Since:
2.5
- Required:
No
<tempDir>
The temporary-surefire-boot directory is project.build.directory on most platforms or system default temporary-directory specified by the system property
java.io.tmpdir
on Windows (see SUREFIRE-1400).
It is deleted after the test set has completed.
- Type:
java.lang.String
- Since:
2.20
- Required:
No
- User Property:
tempDir
- Default:
surefire
<test>
includes
and excludes
. Each pattern you specify here will be used to create an include pattern formatted like **/${it.test}.java
, so you can just type -Dit.test=MyIT
to run a single test file called "foo/MyIT.java". The test patterns prefixed with a ! will be excluded.
This parameter overrides the parameter
includes
and excludes
, and the TestNG parameter suiteXmlFiles
.
Since 2.7.3 You can execute a limited number of methods in the test with adding #myMethod or #my*ethod. E.g. type
-Dit.test=MyIT#myMethod
supported for junit 4.x and TestNg.
Since 2.19 a complex syntax is supported in one parameter (JUnit 4, JUnit 4.7+, TestNG):
"-Dit.test=???IT, !Unstable*, pkg/**/Ci*leIT.java, *IT#test*One+testTwo?????, #fast*+slowTest"
or e.g.
"-Dit.test=Basic*, !%regex[.*.Unstable.*], !%regex[.*.MyIT.class#one.*|two.*], %regex[#fast.*|slow.*]"
The Parameterized JUnit runner
describes
test methods using an index in brackets, so the non-regex method pattern would become: #testMethod[*]
. If using @Parameters(name="{index}: fib({0})={1}")
and selecting the index e.g. 5 in pattern, the non-regex method pattern would become #testMethod[5:*]
.- Type:
java.lang.String
- Required:
No
- User Property:
it.test
<testClassesDirectory>
- Type:
java.io.File
- Required:
No
- Default:
${project.build.testOutputDirectory}
<testNGArtifactName>
org.testng:testng
will be used.- Type:
java.lang.String
- Since:
2.3.1
- Required:
No
- User Property:
testNGArtifactName
- Default:
org.testng:testng
<testSourceDirectory>
- Type:
java.io.File
- Since:
2.2
- Required:
No
- Default:
${project.build.testSourceDirectory}
<threadCount>
parallel
parameter.- Type:
int
- Since:
2.2
- Required:
No
- User Property:
threadCount
<threadCountClasses>
- number of concurrent classes if
threadCount
is 0 or unspecified - limited classes concurrency if
useUnlimitedThreads
is set to true - if
threadCount
and certain thread-count parameters are > 0 forparallel
, the concurrency is computed from ratio. For instanceparallel=all
and the ratio betweenthreadCountSuites
:threadCountClasses
:threadCountMethods
is 2:3:5, there is 30% ofthreadCount
in concurrent classes. - as in the previous case but without this leaf thread-count. Example:
parallel=suitesAndClasses
,threadCount=16
,threadCountSuites=5
,threadCountClasses
is unspecified leaf, the number of concurrent classes is varying from >= 11 to 14 or 15. ThethreadCountSuites
become given number of threads.
parallel
parameter. The default value 0 behaves same as unspecified one.- Type:
int
- Since:
2.16
- Required:
No
- User Property:
threadCountClasses
- Default:
0
<threadCountMethods>
- number of concurrent methods if
threadCount
is 0 or unspecified - limited concurrency of methods if
useUnlimitedThreads
is set to true - if
threadCount
and certain thread-count parameters are > 0 forparallel
, the concurrency is computed from ratio. For instance parallel=all and the ratio betweenthreadCountSuites
:threadCountClasses
:threadCountMethods
is 2:3:5, there is 50% ofthreadCount
which appears in concurrent methods. - as in the previous case but without this leaf thread-count. Example:
parallel=all
,threadCount=16
,threadCountSuites=2
,threadCountClasses=3
, butthreadCountMethods
is unspecified leaf, the number of concurrent methods is varying from >= 11 to 14 or 15. ThethreadCountSuites
andthreadCountClasses
become given number of threads.
parallel
parameter. The default value 0 behaves same as unspecified one.- Type:
int
- Since:
2.16
- Required:
No
- User Property:
threadCountMethods
- Default:
0
<threadCountSuites>
- number of concurrent suites if
threadCount
is 0 or unspecified - limited suites concurrency if
useUnlimitedThreads
is set to true - if
threadCount
and certain thread-count parameters are > 0 forparallel
, the concurrency is computed from ratio. For instanceparallel=all
and the ratio betweenthreadCountSuites
:threadCountClasses
:threadCountMethods
is 2:3:5, there is 20% ofthreadCount
which appeared in concurrent suites.
parallel
parameter. The default value 0 behaves same as unspecified one.- Type:
int
- Since:
2.16
- Required:
No
- User Property:
threadCountSuites
- Default:
0
<trimStackTrace>
- Type:
boolean
- Since:
2.2
- Required:
No
- User Property:
trimStackTrace
- Default:
false
<useFile>
- Type:
boolean
- Required:
No
- User Property:
failsafe.useFile
- Default:
true
<useManifestOnlyJar>
Beware, setting this to "false" may cause your tests to fail on Windows if your classpath is too long.
- Type:
boolean
- Since:
2.4.3
- Required:
No
- User Property:
failsafe.useManifestOnlyJar
- Default:
true
<useModulePath>
true
, uses the modulepath when executing with JDK 9+ and module-info.java is present. When false
, always uses the classpath.
Defaults to
true
.- Type:
boolean
- Since:
3.0.0-M2
- Required:
No
- User Property:
failsafe.useModulePath
- Default:
true
<useSystemClassLoader>
- Type:
boolean
- Since:
2.3
- Required:
No
- User Property:
failsafe.useSystemClassLoader
- Default:
true
<useUnlimitedThreads>
parallel
parameter and the actual number of classes/methods will decide. Setting this to "true" effectively disables perCoreThreadCount
and threadCount
. Defaults to "false".- Type:
boolean
- Since:
2.5
- Required:
No
- User Property:
useUnlimitedThreads
- Default:
false
<workingDirectory>
- Type:
java.io.File
- Since:
2.1.3
- Required:
No
- User Property:
basedir