Package org.apache.maven.plugin.failsafe
Class IntegrationTestMojo
- java.lang.Object
-
- org.apache.maven.plugin.AbstractMojo
-
- org.apache.maven.plugin.surefire.AbstractSurefireMojo
-
- org.apache.maven.plugin.failsafe.IntegrationTestMojo
-
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo,org.apache.maven.plugin.surefire.SurefireExecutionParameters
@Mojo(name="integration-test", requiresProject=true, requiresDependencyResolution=TEST, defaultPhase=INTEGRATION_TEST, threadSafe=true) public class IntegrationTestMojo extends org.apache.maven.plugin.surefire.AbstractSurefireMojoRun integration tests using Surefire.
-
-
Field Summary
Fields Modifier and Type Field Description private java.io.FileclassesDirectoryThe path representing project JAR file, if exists; Otherwise the directory containing generated classes of the project being tested.private java.lang.StringdebugForkedProcessAttach a debugger to the forked JVM.private java.io.FiledefaultClassesDirectoryprivate java.lang.StringenableProcessCheckerSince 3.0.0-M4 the process checkers are disabled.private java.lang.StringencodingThe character encoding scheme to be applied while generating test report files (see target/surefire-reports/yourTestName.txt).private java.lang.String[]excludedEnvironmentVariablesYou can selectively exclude individual environment variables by enumerating their keys.private java.lang.String[]excludeJUnit5EnginesProvide the ID/s of an JUnit engine to be excluded in the test run.private java.util.List<java.lang.String>excludesA list of <exclude> elements specifying the tests (by pattern) that should be excluded in testing.private java.io.FileexcludesFileA file containing exclude patterns, each in a next line.private booleanfailIfNoSpecifiedTestsSet this to "false" to prevent a failure if none of the tests specified in -Dit.test=...private booleanfailIfNoSpecifiedTestsDeprecatedDeprecated.Since 3.0.0-M8, use "failsafe.failIfNoSpecifiedTests" instead.private static java.lang.StringFAILSAFE_IN_PROGRESS_CONTEXT_KEYprivate intforkedProcessExitTimeoutInSecondsForked process is normally terminated without any significant delay after given tests have completed.private intforkedProcessTimeoutInSecondsKill the forked test process after a certain number of seconds.private org.apache.maven.surefire.extensions.ForkNodeFactoryforkNodeThis parameter configures the forked node.private java.lang.String[]includeJUnit5EnginesProvide the ID/s of an JUnit engine to be included in the test run.private java.util.List<java.lang.String>includesprivate java.io.FileincludesFileA file containing include patterns, each in a next line.private doubleparallelTestsTimeoutForcedInSecondsStop executing queued parallel JUnit tests and interrupt currently running tests after a certain number of seconds.private doubleparallelTestsTimeoutInSecondsStop executing queued parallel JUnit tests after a certain number of seconds.private booleanprintSummaryOption to print summary of test suites or just print the test cases that have errors.private java.lang.StringreportFormatSelects the formatting for the test report to be generated.private java.io.FilereportsDirectoryBase directory where all reports are written to.private intrerunFailingTestsCount(JUnit 4+ providers and JUnit 5+ providers since 3.0.0-M4) The number of times each failing test will be rerun.private java.lang.StringrunOrderDefines the order the tests will be run in.private java.lang.LongrunOrderRandomSeedSets the random seed that will be used to order the tests iffailsafe.runOrderis set torandom.private java.lang.StringrunOrderStatisticsFileChecksumUsed to override the checksum in the name of the statistics file whenfailsafe.runOrderis set to "balanced".private java.lang.StringshutdownAfter the plugin process is shutdown by sending SIGTERM signal (CTRL+C), SHUTDOWN command is received by every forked JVM.private intskipAfterFailureCountSet to error/failure count in order to skip remaining tests.private booleanskipITsSet this to "true" to skip running integration tests, but still compile them.private java.io.File[]suiteXmlFiles(TestNG) List of <suiteXmlFile> elements specifying TestNG suite xml file locations.private java.io.FilesummaryFileThe summary file to write integration test results to.private java.io.FilesystemPropertiesFileProperties file being used as system properties passed to the provider.private java.lang.Stringtestprivate booleanuseFileOption to generate a file test report or just output the test report to the console.private booleanuseManifestOnlyJarBy 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.private booleanuseModulePathWhentrue, uses the modulepath when executing with JDK 9+ and module-info.java is present.private booleanuseSystemClassLoaderOption to pass dependencies to the system's classloader instead of using an isolated class loader when forking.
-
Constructor Summary
Constructors Constructor Description IntegrationTestMojo()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected voidaddPluginSpecificChecksumItems(org.apache.maven.plugin.surefire.booterclient.ChecksumCalculator checksum)java.io.FilegetBasedir()java.lang.StringgetDebugForkedProcess()protected java.lang.String[]getDefaultIncludes()protected java.lang.StringgetEnableProcessChecker()java.lang.StringgetEncoding()protected java.lang.String[]getExcludedEnvironmentVariables()java.lang.String[]getExcludeJUnit5Engines()java.util.List<java.lang.String>getExcludes()java.io.FilegetExcludesFile()booleangetFailIfNoSpecifiedTests()intgetForkedProcessExitTimeoutInSeconds()intgetForkedProcessTimeoutInSeconds()protected org.apache.maven.surefire.extensions.ForkNodeFactorygetForkNode()java.lang.String[]getIncludeJUnit5Engines()java.util.List<java.lang.String>getIncludes()java.io.FilegetIncludesFile()java.io.FilegetMainBuildPath()doublegetParallelTestsTimeoutForcedInSeconds()doublegetParallelTestsTimeoutInSeconds()protected java.lang.StringgetPluginName()java.lang.StringgetReportFormat()protected java.lang.StringgetReportSchemaLocation()java.io.FilegetReportsDirectory()protected intgetRerunFailingTestsCount()java.lang.StringgetRunOrder()java.lang.LonggetRunOrderRandomSeed()java.lang.StringgetRunOrderStatisticsFileChecksum()java.lang.StringgetShutdown()intgetSkipAfterFailureCount()java.io.File[]getSuiteXmlFiles()java.io.FilegetSummaryFile()java.io.FilegetSystemPropertiesFile()java.lang.StringgetTest()java.io.FilegetTestClassesDirectory()protected voidhandleSummary(org.apache.maven.surefire.api.suite.RunResult summary, java.lang.Exception firstForkException)protected booleanhasSuiteXmlFiles()private booleanisJarArtifact(java.io.File artifactFile)booleanisPrintSummary()booleanisSkip()booleanisSkipExec()Deprecated.protected booleanisSkipExecution()booleanisSkipITs()booleanisSkipTests()booleanisTestFailureIgnore()booleanisUseFile()booleanisUseManifestOnlyJar()booleanisUseSystemClassLoader()voidsetBasedir(java.io.File basedir)voidsetDebugForkedProcess(java.lang.String debugForkedProcess)voidsetDefaultClassesDirectory(java.io.File defaultClassesDirectory)voidsetEncoding(java.lang.String encoding)(package private) voidsetExcludedEnvironmentVariables(java.lang.String[] excludedEnvironmentVariables)voidsetExcludeJUnit5Engines(java.lang.String[] excludeJUnit5Engines)voidsetExcludes(java.util.List<java.lang.String> excludes)voidsetFailIfNoSpecifiedTests(boolean failIfNoSpecifiedTests)voidsetForkedProcessExitTimeoutInSeconds(int forkedProcessExitTimeoutInSeconds)voidsetForkedProcessTimeoutInSeconds(int forkedProcessTimeoutInSeconds)voidsetIncludeJUnit5Engines(java.lang.String[] includeJUnit5Engines)voidsetIncludes(java.util.List<java.lang.String> includes)voidsetMainBuildPath(java.io.File mainBuildPath)voidsetParallelTestsTimeoutForcedInSeconds(double parallelTestsTimeoutForcedInSeconds)voidsetParallelTestsTimeoutInSeconds(double parallelTestsTimeoutInSeconds)voidsetPrintSummary(boolean printSummary)voidsetReportFormat(java.lang.String reportFormat)voidsetReportsDirectory(java.io.File reportsDirectory)voidsetRunOrder(java.lang.String runOrder)voidsetRunOrderRandomSeed(java.lang.Long runOrderRandomSeed)voidsetRunOrderStatisticsFileChecksum(java.lang.String runOrderStatisticsFileChecksum)voidsetSkip(boolean skip)voidsetSkipExec(boolean skipExec)Deprecated.voidsetSkipITs(boolean skipITs)voidsetSkipTests(boolean skipTests)Deprecated.voidsetSuiteXmlFiles(java.io.File[] suiteXmlFiles)voidsetSummaryFile(java.io.File summaryFile)voidsetSystemPropertiesFile(java.io.File systemPropertiesFile)voidsetTest(java.lang.String test)voidsetTestClassesDirectory(java.io.File testClassesDirectory)voidsetTestFailureIgnore(boolean testFailureIgnore)voidsetUseFile(boolean useFile)voidsetUseManifestOnlyJar(boolean useManifestOnlyJar)protected voidsetUseModulePath(boolean useModulePath)voidsetUseSystemClassLoader(boolean useSystemClassLoader)protected java.util.List<java.io.File>suiteXmlFiles()private static java.io.FiletoAbsoluteCanonical(java.io.File f)protected booleanuseModulePath()-
Methods inherited from class org.apache.maven.plugin.surefire.AbstractSurefireMojo
cleanupForkConfiguration, convertWithCoreCount, createCopyAndReplaceForkNumPlaceholder, createProviders, effectiveIsEnableAssertions, execute, getAdditionalClasspathElements, getArgLine, getClassLoaderConfiguration, getClasspathDependencyExcludes, getClasspathDependencyScopeExclude, getConsoleLogger, getDependenciesToScan, getEffectiveForkCount, getEnvironmentVariables, getExcludedGroups, getFailIfNoTests, getForkCount, getGroups, getJdkToolchain, getJunitArtifactName, getJvm, getLocalRepositoryPath, getMojoArtifact, getObjectFactory, getParallel, getPerCoreThreadCount, getPluginArtifactMap, getPluginDescriptor, getProject, getProjectArtifactMap, getProjectBuildDirectory, getReportNameSuffix, getSession, getSpecificTests, getSystemProperties, getSystemPropertyVariables, getTempDir, getTestNGArtifactName, getTestSourceDirectory, getThreadCount, getThreadCountClasses, getThreadCountMethods, getThreadCountSuites, getToolchainManager, getUseUnlimitedThreads, getWorkingDirectory, hasExecutedBefore, isAnyConcurrencySelected, isAnyGroupsSelected, isChildDelegation, isEnableAssertions, isEnableOutErrElements, isEnablePropertiesElement, isForking, isMavenParallel, isParallelOptimized, isRedirectTestOutputToFile, isReuseForks, isTrimStackTrace, logDebugOrCliShowErrors, logReportsDirectory, resolveDependencies, setAdditionalClasspathElements, setArgLine, setChildDelegation, setClasspathDependencyExcludes, setClasspathDependencyScopeExclude, setDependenciesToScan, setEnableAssertions, setEnableOutErrElements, setEnablePropertiesElement, setEnvironmentVariables, setExcludedGroups, setFailIfNoTests, setGroups, setJdkToolchain, setJunitArtifactName, setObjectFactory, setParallel, setParallelOptimized, setPerCoreThreadCount, setPluginArtifactMap, setProject, setProjectArtifactMap, setProjectBuildDirectory, setProperties, setRedirectTestOutputToFile, setReportNameSuffix, setSession, setSystemProperties, setSystemPropertyVariables, setTempDir, setTestNGArtifactName, setTestSourceDirectory, setThreadCount, setThreadCountClasses, setThreadCountMethods, setThreadCountSuites, setToolchainManager, setTrimStackTrace, setUseUnlimitedThreads, setWorkingDirectory, warnIfIllegalFailOnFlakeCount
-
-
-
-
Field Detail
-
FAILSAFE_IN_PROGRESS_CONTEXT_KEY
private static final java.lang.String FAILSAFE_IN_PROGRESS_CONTEXT_KEY
- See Also:
- Constant Field Values
-
classesDirectory
@Parameter private java.io.File classesDirectory
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}.
-
defaultClassesDirectory
@Parameter(defaultValue="${project.build.outputDirectory}", readonly=true, required=true) private java.io.File defaultClassesDirectory
-
skipITs
@Parameter(property="skipITs") private boolean skipITs
Set this to "true" to skip running integration tests, but still compile them. Its use is NOT RECOMMENDED, but quite convenient on occasion.- Since:
- 2.4.3-alpha-2
-
reportsDirectory
@Parameter(defaultValue="${project.build.directory}/failsafe-reports") private java.io.File reportsDirectoryBase directory where all reports are written to.
-
test
@Parameter(property="it.test") private java.lang.String test
-
summaryFile
@Parameter(defaultValue="${project.build.directory}/failsafe-reports/failsafe-summary.xml", required=true) private java.io.File summaryFileThe summary file to write integration test results to.
-
printSummary
@Parameter(property="failsafe.printSummary", defaultValue="true") private boolean printSummaryOption to print summary of test suites or just print the test cases that have errors.
-
reportFormat
@Parameter(property="failsafe.reportFormat", defaultValue="brief") private java.lang.String reportFormatSelects 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)
-
useFile
@Parameter(property="failsafe.useFile", defaultValue="true") private boolean useFileOption to generate a file test report or just output the test report to the console.
-
failIfNoSpecifiedTestsDeprecated
@Deprecated @Parameter(property="it.failIfNoSpecifiedTests", defaultValue="true") private boolean failIfNoSpecifiedTestsDeprecatedDeprecated.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".- Since:
- 2.12
-
failIfNoSpecifiedTests
@Parameter(property="failsafe.failIfNoSpecifiedTests", defaultValue="true") private boolean failIfNoSpecifiedTestsSet 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.- Since:
- 3.0.0-M8
-
debugForkedProcess
@Parameter(property="maven.failsafe.debug") private java.lang.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 debugging ability options (without overwriting the other options specified through theargLineparameter).- Since:
- 2.4
-
forkedProcessTimeoutInSeconds
@Parameter(property="failsafe.timeout") private int forkedProcessTimeoutInSeconds
Kill the forked test process after a certain number of seconds. If set to 0, wait forever for the process, never timing out.- Since:
- 2.4
-
forkedProcessExitTimeoutInSeconds
@Parameter(property="failsafe.exitTimeout", defaultValue="30") private int forkedProcessExitTimeoutInSecondsForked 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 bySystem.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- Since:
- 2.20
-
parallelTestsTimeoutInSeconds
@Parameter(property="failsafe.parallel.timeout") private double parallelTestsTimeoutInSeconds
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 specifiedparalleldifferent from "none".- Since:
- 2.16
-
parallelTestsTimeoutForcedInSeconds
@Parameter(property="failsafe.parallel.forcedTimeout") private double parallelTestsTimeoutForcedInSeconds
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 specifiedparalleldifferent from "none".- Since:
- 2.16
-
includes
@Parameter(property="failsafe.includes") private java.util.List<java.lang.String> includes
-
excludes
@Parameter(property="failsafe.excludes") private java.util.List<java.lang.String> excludes
A list of <exclude> elements specifying the tests (by pattern) that should be excluded in testing. When not specified and when thetestparameter is not specified, the default excludes will be
(which excludes all inner classes).<excludes> <exclude>**/*$*</exclude> </excludes>
This parameter is ignored if the TestNGsuiteXmlFilesparameter 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 parametertestClassesDirectorywhich defaults to the POM property${project.build.testOutputDirectory}, typicallysrc/test/javaunless overridden.
-
useSystemClassLoader
@Parameter(property="failsafe.useSystemClassLoader", defaultValue="true") private boolean useSystemClassLoaderOption 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.- Since:
- 2.3
-
useManifestOnlyJar
@Parameter(property="failsafe.useManifestOnlyJar", defaultValue="true") private boolean useManifestOnlyJarBy 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.- Since:
- 2.4.3
-
encoding
@Parameter(property="encoding", defaultValue="${project.reporting.outputEncoding}") private java.lang.String encodingThe 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.- Since:
- 3.0.0-M1
-
rerunFailingTestsCount
@Parameter(property="failsafe.rerunFailingTestsCount", defaultValue="0") private int rerunFailingTestsCount(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.
-
suiteXmlFiles
@Parameter(property="failsafe.suiteXmlFiles") private java.io.File[] suiteXmlFiles
(TestNG) List of <suiteXmlFile> elements specifying TestNG suite xml file locations. Note thatsuiteXmlFilesis incompatible with several other parameters of this plugin, likeincludesandexcludes.
This parameter is ignored if thetestparameter is specified (allowing you to run a single test instead of an entire suite).- Since:
- 2.2
-
runOrder
@Parameter(property="failsafe.runOrder", defaultValue="filesystem") private java.lang.String runOrderDefines the order the tests will be run in. Supported values arealphabetical,reversealphabetical,random,hourly(alphabetical on even hours, reverse alphabetical on odd hours),failedfirst,balancedandfilesystem.
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.- Since:
- 2.7
-
runOrderRandomSeed
@Parameter(property="failsafe.runOrder.random.seed") private java.lang.Long runOrderRandomSeed
Sets the random seed that will be used to order the tests iffailsafe.runOrderis set torandom.
If no seeds are set andfailsafe.runOrderis set torandom, 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.- Since:
- 3.0.0-M6
-
runOrderStatisticsFileChecksum
@Parameter(property="failsafe.runOrder.statisticsFile.checksum") private java.lang.String runOrderStatisticsFileChecksum
Used to override the checksum in the name of the statistics file whenfailsafe.runOrderis set to "balanced".- Since:
- 3.5.5
-
includesFile
@Parameter(property="failsafe.includesFile") private java.io.File includesFile
A file containing include patterns, each in a next line. Blank lines, or lines starting with # are ignored. Ifincludesare 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- Since:
- 2.13
-
excludesFile
@Parameter(property="failsafe.excludesFile") private java.io.File excludesFile
A file containing exclude patterns, each in a next line. Blank lines, or lines starting with # are ignored. Ifexcludesare 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- Since:
- 2.13
-
skipAfterFailureCount
@Parameter(property="failsafe.skipAfterFailureCount", defaultValue="0") private int skipAfterFailureCountSet 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=1or 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- Since:
- 2.19
-
shutdown
@Parameter(property="failsafe.shutdown", defaultValue="exit") private java.lang.String shutdownAfter 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 valuestestsetandkill.
With(shutdown=testset) the test set may still continue to run in forked JVM.
Usingexitforked JVM executesSystem.exit(1)after the plugin process has received SIGTERM signal.
Usingkillthe JVM executesRuntime.halt(1)and kills itself.- Since:
- 2.19
-
useModulePath
@Parameter(property="failsafe.useModulePath", defaultValue="true") private boolean useModulePathWhentrue, uses the modulepath when executing with JDK 9+ and module-info.java is present. Whenfalse, always uses the classpath.
Defaults totrue.- Since:
- 3.0.0-M2
-
forkNode
@Parameter(property="failsafe.forkNode") private org.apache.maven.surefire.extensions.ForkNodeFactory forkNode
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- Since:
- 3.0.0-M5
-
excludedEnvironmentVariables
@Parameter(property="failsafe.excludedEnvironmentVariables") private java.lang.String[] excludedEnvironmentVariables
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- Since:
- 3.0.0-M4
-
enableProcessChecker
@Parameter(property="failsafe.enableProcessChecker") private java.lang.String enableProcessChecker
Since 3.0.0-M4 the process checkers are disabled. You can enable them namely by settingpingandnativeorallin 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.
Thepingshould be safely used together with ZGC or Shenandoah Garbage Collector. Due to thepingrelies 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.
Thenativeis 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 isforkedProcessTimeoutInSeconds.
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- Since:
- 3.0.0-M4
-
systemPropertiesFile
@Parameter(property="failsafe.systemPropertiesFile") private java.io.File systemPropertiesFile
Properties file being used as system properties passed to the provider.- See Also:
for how the effective provider properties are calculated
-
includeJUnit5Engines
@Parameter(property="failsafe.includeJUnit5Engines") private java.lang.String[] includeJUnit5Engines
Provide the ID/s of an JUnit engine to be included in the test run.- Since:
- 3.0.0-M6
-
excludeJUnit5Engines
@Parameter(property="failsafe.excludeJUnit5Engines") private java.lang.String[] excludeJUnit5Engines
Provide the ID/s of an JUnit engine to be excluded in the test run.- Since:
- 3.0.0-M6
-
-
Method Detail
-
getRerunFailingTestsCount
protected int getRerunFailingTestsCount()
- Specified by:
getRerunFailingTestsCountin classorg.apache.maven.plugin.surefire.AbstractSurefireMojo
-
handleSummary
protected void handleSummary(org.apache.maven.surefire.api.suite.RunResult summary, java.lang.Exception firstForkException) throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException- Specified by:
handleSummaryin classorg.apache.maven.plugin.surefire.AbstractSurefireMojo- Throws:
org.apache.maven.plugin.MojoExecutionExceptionorg.apache.maven.plugin.MojoFailureException
-
isJarArtifact
private boolean isJarArtifact(java.io.File artifactFile)
-
toAbsoluteCanonical
private static java.io.File toAbsoluteCanonical(java.io.File f)
-
isSkipExecution
protected boolean isSkipExecution()
- Specified by:
isSkipExecutionin classorg.apache.maven.plugin.surefire.AbstractSurefireMojo
-
getPluginName
protected java.lang.String getPluginName()
- Specified by:
getPluginNamein classorg.apache.maven.plugin.surefire.AbstractSurefireMojo
-
getDefaultIncludes
protected java.lang.String[] getDefaultIncludes()
- Specified by:
getDefaultIncludesin classorg.apache.maven.plugin.surefire.AbstractSurefireMojo
-
getReportSchemaLocation
protected java.lang.String getReportSchemaLocation()
- Specified by:
getReportSchemaLocationin classorg.apache.maven.plugin.surefire.AbstractSurefireMojo
-
isSkipTests
public boolean isSkipTests()
-
setSkipTests
@Deprecated public void setSkipTests(boolean skipTests)
Deprecated.
-
isSkipITs
public boolean isSkipITs()
-
setSkipITs
public void setSkipITs(boolean skipITs)
-
isSkipExec
@Deprecated public boolean isSkipExec()
Deprecated.
-
setSkipExec
@Deprecated public void setSkipExec(boolean skipExec)
Deprecated.
-
isSkip
public boolean isSkip()
-
setSkip
public void setSkip(boolean skip)
-
getBasedir
public java.io.File getBasedir()
-
setBasedir
public void setBasedir(java.io.File basedir)
-
getTestClassesDirectory
public java.io.File getTestClassesDirectory()
-
setTestClassesDirectory
public void setTestClassesDirectory(java.io.File testClassesDirectory)
-
getMainBuildPath
public java.io.File getMainBuildPath()
- Returns:
- Output directory, or artifact file if artifact type is "jar". If not forking the JVM, parameter
useSystemClassLoaderis ignored and theIsolatedClassLoaderis used instead. See the resolution ofClassLoaderConfiguration.
-
setMainBuildPath
public void setMainBuildPath(java.io.File mainBuildPath)
-
setDefaultClassesDirectory
public void setDefaultClassesDirectory(java.io.File defaultClassesDirectory)
-
getReportsDirectory
public java.io.File getReportsDirectory()
-
setReportsDirectory
public void setReportsDirectory(java.io.File reportsDirectory)
-
getTest
public java.lang.String getTest()
-
setTest
public void setTest(java.lang.String test)
-
getSummaryFile
public java.io.File getSummaryFile()
-
setSummaryFile
public void setSummaryFile(java.io.File summaryFile)
-
isPrintSummary
public boolean isPrintSummary()
-
setPrintSummary
public void setPrintSummary(boolean printSummary)
-
getReportFormat
public java.lang.String getReportFormat()
-
setReportFormat
public void setReportFormat(java.lang.String reportFormat)
-
isUseFile
public boolean isUseFile()
-
setUseFile
public void setUseFile(boolean useFile)
-
getDebugForkedProcess
public java.lang.String getDebugForkedProcess()
-
setDebugForkedProcess
public void setDebugForkedProcess(java.lang.String debugForkedProcess)
-
getForkedProcessTimeoutInSeconds
public int getForkedProcessTimeoutInSeconds()
-
setForkedProcessTimeoutInSeconds
public void setForkedProcessTimeoutInSeconds(int forkedProcessTimeoutInSeconds)
-
getForkedProcessExitTimeoutInSeconds
public int getForkedProcessExitTimeoutInSeconds()
-
setForkedProcessExitTimeoutInSeconds
public void setForkedProcessExitTimeoutInSeconds(int forkedProcessExitTimeoutInSeconds)
-
getParallelTestsTimeoutInSeconds
public double getParallelTestsTimeoutInSeconds()
-
setParallelTestsTimeoutInSeconds
public void setParallelTestsTimeoutInSeconds(double parallelTestsTimeoutInSeconds)
-
getParallelTestsTimeoutForcedInSeconds
public double getParallelTestsTimeoutForcedInSeconds()
-
setParallelTestsTimeoutForcedInSeconds
public void setParallelTestsTimeoutForcedInSeconds(double parallelTestsTimeoutForcedInSeconds)
-
isUseSystemClassLoader
public boolean isUseSystemClassLoader()
-
setUseSystemClassLoader
public void setUseSystemClassLoader(boolean useSystemClassLoader)
-
isUseManifestOnlyJar
public boolean isUseManifestOnlyJar()
-
setUseManifestOnlyJar
public void setUseManifestOnlyJar(boolean useManifestOnlyJar)
-
getEncoding
public java.lang.String getEncoding()
-
setEncoding
public void setEncoding(java.lang.String encoding)
-
isTestFailureIgnore
public boolean isTestFailureIgnore()
-
setTestFailureIgnore
public void setTestFailureIgnore(boolean testFailureIgnore)
-
addPluginSpecificChecksumItems
protected void addPluginSpecificChecksumItems(org.apache.maven.plugin.surefire.booterclient.ChecksumCalculator checksum)
- Overrides:
addPluginSpecificChecksumItemsin classorg.apache.maven.plugin.surefire.AbstractSurefireMojo
-
getSystemPropertiesFile
public java.io.File getSystemPropertiesFile()
- Specified by:
getSystemPropertiesFilein classorg.apache.maven.plugin.surefire.AbstractSurefireMojo
-
setSystemPropertiesFile
public void setSystemPropertiesFile(java.io.File systemPropertiesFile)
- Specified by:
setSystemPropertiesFilein classorg.apache.maven.plugin.surefire.AbstractSurefireMojo
-
getFailIfNoSpecifiedTests
public boolean getFailIfNoSpecifiedTests()
-
setFailIfNoSpecifiedTests
public void setFailIfNoSpecifiedTests(boolean failIfNoSpecifiedTests)
-
getSkipAfterFailureCount
public int getSkipAfterFailureCount()
-
getShutdown
public java.lang.String getShutdown()
-
getIncludes
public java.util.List<java.lang.String> getIncludes()
- Specified by:
getIncludesin interfaceorg.apache.maven.plugin.surefire.SurefireExecutionParameters- Specified by:
getIncludesin classorg.apache.maven.plugin.surefire.AbstractSurefireMojo
-
setIncludes
public void setIncludes(java.util.List<java.lang.String> includes)
- Specified by:
setIncludesin interfaceorg.apache.maven.plugin.surefire.SurefireExecutionParameters- Specified by:
setIncludesin classorg.apache.maven.plugin.surefire.AbstractSurefireMojo
-
getExcludes
public java.util.List<java.lang.String> getExcludes()
-
setExcludes
public void setExcludes(java.util.List<java.lang.String> excludes)
-
getSuiteXmlFiles
public java.io.File[] getSuiteXmlFiles()
- Specified by:
getSuiteXmlFilesin classorg.apache.maven.plugin.surefire.AbstractSurefireMojo
-
setSuiteXmlFiles
public void setSuiteXmlFiles(java.io.File[] suiteXmlFiles)
- Specified by:
setSuiteXmlFilesin classorg.apache.maven.plugin.surefire.AbstractSurefireMojo
-
getRunOrder
public java.lang.String getRunOrder()
- Specified by:
getRunOrderin classorg.apache.maven.plugin.surefire.AbstractSurefireMojo
-
setRunOrder
public void setRunOrder(java.lang.String runOrder)
- Specified by:
setRunOrderin classorg.apache.maven.plugin.surefire.AbstractSurefireMojo
-
getRunOrderRandomSeed
public java.lang.Long getRunOrderRandomSeed()
- Specified by:
getRunOrderRandomSeedin classorg.apache.maven.plugin.surefire.AbstractSurefireMojo
-
setRunOrderRandomSeed
public void setRunOrderRandomSeed(java.lang.Long runOrderRandomSeed)
- Specified by:
setRunOrderRandomSeedin classorg.apache.maven.plugin.surefire.AbstractSurefireMojo
-
getRunOrderStatisticsFileChecksum
public java.lang.String getRunOrderStatisticsFileChecksum()
- Specified by:
getRunOrderStatisticsFileChecksumin classorg.apache.maven.plugin.surefire.AbstractSurefireMojo
-
setRunOrderStatisticsFileChecksum
public void setRunOrderStatisticsFileChecksum(java.lang.String runOrderStatisticsFileChecksum)
- Specified by:
setRunOrderStatisticsFileChecksumin classorg.apache.maven.plugin.surefire.AbstractSurefireMojo
-
getIncludesFile
public java.io.File getIncludesFile()
- Specified by:
getIncludesFilein classorg.apache.maven.plugin.surefire.AbstractSurefireMojo
-
getExcludesFile
public java.io.File getExcludesFile()
- Specified by:
getExcludesFilein classorg.apache.maven.plugin.surefire.AbstractSurefireMojo
-
useModulePath
protected boolean useModulePath()
- Specified by:
useModulePathin classorg.apache.maven.plugin.surefire.AbstractSurefireMojo
-
setUseModulePath
protected void setUseModulePath(boolean useModulePath)
- Specified by:
setUseModulePathin classorg.apache.maven.plugin.surefire.AbstractSurefireMojo
-
suiteXmlFiles
protected final java.util.List<java.io.File> suiteXmlFiles()
- Specified by:
suiteXmlFilesin classorg.apache.maven.plugin.surefire.AbstractSurefireMojo
-
hasSuiteXmlFiles
protected final boolean hasSuiteXmlFiles()
- Specified by:
hasSuiteXmlFilesin classorg.apache.maven.plugin.surefire.AbstractSurefireMojo
-
getForkNode
protected final org.apache.maven.surefire.extensions.ForkNodeFactory getForkNode()
- Specified by:
getForkNodein classorg.apache.maven.plugin.surefire.AbstractSurefireMojo
-
getExcludedEnvironmentVariables
protected final java.lang.String[] getExcludedEnvironmentVariables()
- Specified by:
getExcludedEnvironmentVariablesin classorg.apache.maven.plugin.surefire.AbstractSurefireMojo
-
setExcludedEnvironmentVariables
void setExcludedEnvironmentVariables(java.lang.String[] excludedEnvironmentVariables)
-
getEnableProcessChecker
protected final java.lang.String getEnableProcessChecker()
- Specified by:
getEnableProcessCheckerin classorg.apache.maven.plugin.surefire.AbstractSurefireMojo
-
getIncludeJUnit5Engines
public java.lang.String[] getIncludeJUnit5Engines()
-
setIncludeJUnit5Engines
public void setIncludeJUnit5Engines(java.lang.String[] includeJUnit5Engines)
-
getExcludeJUnit5Engines
public java.lang.String[] getExcludeJUnit5Engines()
-
setExcludeJUnit5Engines
public void setExcludeJUnit5Engines(java.lang.String[] excludeJUnit5Engines)
-
-