@Mojo(name="integration-test",
requiresProject=true,
requiresDependencyResolution=TEST,
defaultPhase=INTEGRATION_TEST,
threadSafe=true)
public class IntegrationTestMojo
extends AbstractSurefireMojo
| Modifier and Type | Field and Description |
|---|---|
private java.io.File |
classesDirectory
The path representing project JAR file, if exists; Otherwise the directory containing generated
classes of the project being tested.
|
private java.lang.String |
debugForkedProcess
Attach a debugger to the forked JVM.
|
private java.io.File |
defaultClassesDirectory |
private java.lang.String |
encoding
The character encoding scheme to be applied while generating test report
files (see target/surefire-reports/yourTestName.txt).
|
private java.io.File |
excludesFile
A file containing exclude patterns, each in a next line.
|
private java.lang.Boolean |
failIfNoSpecifiedTests
Set this to "true" to cause a failure if none of the tests specified in -Dtest=...
|
private static java.lang.String |
FAILSAFE_IN_PROGRESS_CONTEXT_KEY |
private int |
forkedProcessExitTimeoutInSeconds
Forked process is normally terminated without any significant delay after given tests have completed.
|
private int |
forkedProcessTimeoutInSeconds
Kill the forked test process after a certain number of seconds.
|
private java.util.List<java.lang.String> |
includes |
private java.io.File |
includesFile
A file containing include patterns, each in a next line.
|
private double |
parallelTestsTimeoutForcedInSeconds
Stop executing queued parallel JUnit tests
and interrupt currently running tests after a certain number of seconds.
|
private double |
parallelTestsTimeoutInSeconds
Stop executing queued parallel JUnit tests after a certain number of seconds.
|
private boolean |
printSummary
Option to print summary of test suites or just print the test cases that have errors.
|
private java.lang.String |
reportFormat
Selects the formatting for the test report to be generated.
|
private java.io.File |
reportsDirectory
Base directory where all reports are written to.
|
private int |
rerunFailingTestsCount
(JUnit 4+ providers)
The number of times each failing test will be rerun.
|
private java.lang.String |
runOrder
Defines the order the tests will be run in.
|
private java.lang.String |
shutdown
After the plugin process is shutdown by sending SIGTERM signal (CTRL+C), SHUTDOWN command is
received by every forked JVM.
|
private int |
skipAfterFailureCount
Set to error/failure count in order to skip remaining tests.
|
private boolean |
skipITs
Set 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.File |
summaryFile
The summary file to write integration test results to.
|
private java.lang.String |
test |
private boolean |
useFile
Option to generate a file test report or just output the test report to the console.
|
private boolean |
useManifestOnlyJar
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.
|
private boolean |
useSystemClassLoader
Option to pass dependencies to the system's classloader instead of using an isolated class loader when forking.
|
basedir, FORK_NUMBER_PLACEHOLDER, skip, skipExec, skipTests, testClassesDirectory, THREAD_NUMBER_PLACEHOLDER| Constructor and Description |
|---|
IntegrationTestMojo() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addPluginSpecificChecksumItems(ChecksumCalculator checksum) |
java.io.File |
getBasedir() |
java.io.File |
getClassesDirectory() |
java.lang.String |
getDebugForkedProcess() |
protected java.lang.String[] |
getDefaultIncludes() |
java.lang.String |
getEncoding() |
java.io.File |
getExcludesFile() |
java.lang.Boolean |
getFailIfNoSpecifiedTests() |
int |
getForkedProcessExitTimeoutInSeconds() |
int |
getForkedProcessTimeoutInSeconds() |
java.util.List<java.lang.String> |
getIncludes() |
java.io.File |
getIncludesFile() |
protected org.apache.maven.artifact.Artifact |
getMojoArtifact() |
double |
getParallelTestsTimeoutForcedInSeconds() |
double |
getParallelTestsTimeoutInSeconds() |
protected java.lang.String |
getPluginName() |
java.lang.String |
getReportFormat() |
protected java.lang.String |
getReportSchemaLocation() |
java.io.File |
getReportsDirectory() |
protected int |
getRerunFailingTestsCount() |
java.lang.String |
getRunOrder() |
java.lang.String |
getShutdown() |
int |
getSkipAfterFailureCount() |
java.io.File[] |
getSuiteXmlFiles() |
java.io.File |
getSummaryFile() |
java.lang.String |
getTest() |
java.io.File |
getTestClassesDirectory() |
protected void |
handleSummary(RunResult summary,
java.lang.Exception firstForkException) |
protected boolean |
hasSuiteXmlFiles() |
private boolean |
isJarArtifact(java.io.File artifactFile) |
boolean |
isPrintSummary() |
boolean |
isSkip() |
boolean |
isSkipExec()
Deprecated.
|
protected boolean |
isSkipExecution() |
boolean |
isSkipITs() |
boolean |
isSkipTests() |
boolean |
isTestFailureIgnore() |
boolean |
isUseFile() |
boolean |
isUseManifestOnlyJar() |
boolean |
isUseSystemClassLoader() |
void |
setBasedir(java.io.File basedir) |
void |
setClassesDirectory(java.io.File classesDirectory) |
void |
setDebugForkedProcess(java.lang.String debugForkedProcess) |
void |
setDefaultClassesDirectory(java.io.File defaultClassesDirectory) |
void |
setEncoding(java.lang.String encoding) |
void |
setFailIfNoSpecifiedTests(boolean failIfNoSpecifiedTests) |
void |
setForkedProcessExitTimeoutInSeconds(int forkedProcessExitTimeoutInSeconds) |
void |
setForkedProcessTimeoutInSeconds(int forkedProcessTimeoutInSeconds) |
void |
setIncludes(java.util.List<java.lang.String> includes) |
void |
setParallelTestsTimeoutForcedInSeconds(double parallelTestsTimeoutForcedInSeconds) |
void |
setParallelTestsTimeoutInSeconds(double parallelTestsTimeoutInSeconds) |
void |
setPrintSummary(boolean printSummary) |
void |
setReportFormat(java.lang.String reportFormat) |
void |
setReportsDirectory(java.io.File reportsDirectory) |
void |
setRunOrder(java.lang.String runOrder) |
void |
setSkip(boolean skip) |
void |
setSkipExec(boolean skipExec)
Deprecated.
|
void |
setSkipITs(boolean skipITs) |
void |
setSkipTests(boolean skipTests) |
void |
setSuiteXmlFiles(java.io.File[] suiteXmlFiles) |
void |
setSummaryFile(java.io.File summaryFile) |
void |
setTest(java.lang.String test) |
void |
setTestClassesDirectory(java.io.File testClassesDirectory) |
void |
setTestFailureIgnore(boolean testFailureIgnore) |
void |
setUseFile(boolean useFile) |
void |
setUseManifestOnlyJar(boolean useManifestOnlyJar) |
void |
setUseSystemClassLoader(boolean useSystemClassLoader) |
protected java.util.List<java.io.File> |
suiteXmlFiles()
Calls
AbstractSurefireMojo.getSuiteXmlFiles() as list. |
private static java.io.File |
toAbsoluteCanonical(java.io.File f) |
(package private) static java.nio.charset.Charset |
toCharset(java.lang.String encoding) |
cleanupForkConfiguration, convertWithCoreCount, createCopyAndReplaceForkNumPlaceholder, createProviders, effectiveIsEnableAssertions, execute, getAdditionalClasspathElements, getArgLine, getArtifactFactory, getArtifactResolver, getClassLoaderConfiguration, getClasspathDependencyExcludes, getClasspathDependencyScopeExclude, getConsoleLogger, getDependenciesToScan, getEffectiveForkCount, getEnvironmentVariables, getExcludedGroups, getExcludes, getFailIfNoTests, getForkCount, getForkMode, getGroups, getJunitArtifactName, getJunitPlatformArtifactName, getJvm, getLocalRepository, getMetadataSource, getObjectFactory, getParallel, getPerCoreThreadCount, getPluginArtifactMap, getPluginDescriptor, getProject, getProjectArtifactMap, getProjectBuildDirectory, getRemoteRepositories, getReportNameSuffix, getSession, getSpecificTests, getStatisticsFile, getSystemProperties, getSystemPropertiesFile, getSystemPropertyVariables, getTempDir, getTestNGArtifactName, getTestSourceDirectory, getThreadCount, getThreadCountClasses, getThreadCountMethods, getThreadCountSuites, getToolchainManager, getUseUnlimitedThreads, getWorkingDirectory, hasExecutedBefore, isAnyConcurrencySelected, isAnyGroupsSelected, isChildDelegation, isDisableXmlReport, isEnableAssertions, isForking, isMavenParallel, isParallelOptimized, isRedirectTestOutputToFile, isReuseForks, isTrimStackTrace, logDebugOrCliShowErrors, logReportsDirectory, setAdditionalClasspathElements, setArgLine, setArtifactFactory, setArtifactResolver, setChildDelegation, setClasspathDependencyExcludes, setClasspathDependencyScopeExclude, setDependenciesToScan, setDisableXmlReport, setEnableAssertions, setEnvironmentVariables, setExcludedGroups, setExcludes, setFailIfNoTests, setForkMode, setGroups, setJunitArtifactName, setJunitPlatformArtifactName, setLocalRepository, setMetadataSource, setObjectFactory, setParallel, setParallelOptimized, setPerCoreThreadCount, setPluginArtifactMap, setProject, setProjectArtifactMap, setProjectBuildDirectory, setProperties, setRedirectTestOutputToFile, setRemoteRepositories, setReportNameSuffix, setSession, setSystemProperties, setSystemPropertiesFile, setSystemPropertyVariables, setTempDir, setTestNGArtifactName, setTestSourceDirectory, setThreadCount, setThreadCountClasses, setThreadCountMethods, setThreadCountSuites, setToolchainManager, setTrimStackTrace, setUseUnlimitedThreads, setWorkingDirectoryprivate static final java.lang.String FAILSAFE_IN_PROGRESS_CONTEXT_KEY
@Parameter private java.io.File classesDirectory
${project.build.outputDirectory}.@Parameter(readonly=true,
defaultValue="${project.build.outputDirectory}")
private java.io.File defaultClassesDirectory
@Parameter(property="skipITs") private boolean skipITs
@Parameter(defaultValue="${project.build.directory}/failsafe-reports")
private java.io.File reportsDirectory
@Parameter(property="it.test") private java.lang.String test
@Parameter(defaultValue="${project.build.directory}/failsafe-reports/failsafe-summary.xml",
required=true)
private java.io.File summaryFile
@Parameter(property="failsafe.printSummary",
defaultValue="true")
private boolean printSummary
@Parameter(property="failsafe.reportFormat",
defaultValue="brief")
private java.lang.String reportFormat
@Parameter(property="failsafe.useFile",
defaultValue="true")
private boolean useFile
@Parameter(property="it.failIfNoSpecifiedTests") private java.lang.Boolean failIfNoSpecifiedTests
@Parameter(property="maven.failsafe.debug") private java.lang.String debugForkedProcess
argLine
parameter).@Parameter(property="failsafe.timeout") private int forkedProcessTimeoutInSeconds
@Parameter(property="failsafe.exitTimeout",
defaultValue="30")
private int 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@Parameter(property="failsafe.parallel.timeout") private double parallelTestsTimeoutInSeconds
parallel different from "none".@Parameter(property="failsafe.parallel.forcedTimeout") private double parallelTestsTimeoutForcedInSeconds
parallel different from "none".@Parameter private java.util.List<java.lang.String> includes
@Parameter(property="failsafe.useSystemClassLoader",
defaultValue="true")
private boolean useSystemClassLoader
@Parameter(property="failsafe.useManifestOnlyJar",
defaultValue="true")
private boolean useManifestOnlyJar
@Parameter(property="encoding",
defaultValue="${project.reporting.outputEncoding}")
private java.lang.String encoding
@Parameter(property="failsafe.rerunFailingTestsCount",
defaultValue="0")
private int rerunFailingTestsCount
@Parameter(property="failsafe.suiteXmlFiles") private java.io.File[] suiteXmlFiles
suiteXmlFiles is incompatible with several other parameters of this plugin, like
includes and excludes.test parameter is specified (allowing you to run a single test
instead of an entire suite).@Parameter(property="failsafe.runOrder",
defaultValue="filesystem")
private java.lang.String runOrder
alphabetical,
reversealphabetical, random, hourly (alphabetical on even hours, reverse alphabetical
on odd hours), failedfirst, balanced and filesystem.
@Parameter(property="failsafe.includesFile") private java.io.File includesFile
includes are also specified, these patterns are appended. Example with path, simple and regex
includes:
* /it /*
** /NotIncludedByDefault.java
%regex[.*IT.*|.*Not.*]
@Parameter(property="failsafe.excludesFile") private java.io.File excludesFile
excludes are also specified, these patterns are appended.
Example with path, simple and regex excludes:
* /it /*
** /DontRunIT.*
%regex[.*IT.*|.*Not.*]
@Parameter(property="failsafe.skipAfterFailureCount",
defaultValue="0")
private int skipAfterFailureCount
-Dfailsafe.skipAfterFailureCount=1 or any number greater than zero.
Defaults to "0".@Parameter(property="failsafe.shutdown",
defaultValue="testset")
private java.lang.String shutdown
shutdown=testset) forked JVM would not continue with new test which means that
the current test may still continue to run.
exit and kill.
exit forked JVM executes System.exit(1) after the plugin process has received
SIGTERM signal.
kill the JVM executes Runtime.halt(1) and kills itself.protected int getRerunFailingTestsCount()
getRerunFailingTestsCount in class AbstractSurefireMojoprotected void handleSummary(RunResult summary, java.lang.Exception firstForkException) throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
handleSummary in class AbstractSurefireMojoorg.apache.maven.plugin.MojoExecutionExceptionorg.apache.maven.plugin.MojoFailureExceptionprivate boolean isJarArtifact(java.io.File artifactFile)
private static java.io.File toAbsoluteCanonical(java.io.File f)
protected boolean isSkipExecution()
isSkipExecution in class AbstractSurefireMojoprotected java.lang.String getPluginName()
getPluginName in class AbstractSurefireMojoprotected java.lang.String[] getDefaultIncludes()
getDefaultIncludes in class AbstractSurefireMojoprotected java.lang.String getReportSchemaLocation()
getReportSchemaLocation in class AbstractSurefireMojoprotected org.apache.maven.artifact.Artifact getMojoArtifact()
getMojoArtifact in class AbstractSurefireMojopublic boolean isSkipTests()
public void setSkipTests(boolean skipTests)
public boolean isSkipITs()
public void setSkipITs(boolean skipITs)
@Deprecated public boolean isSkipExec()
@Deprecated public void setSkipExec(boolean skipExec)
public boolean isSkip()
public void setSkip(boolean skip)
public java.io.File getBasedir()
public void setBasedir(java.io.File basedir)
public java.io.File getTestClassesDirectory()
public void setTestClassesDirectory(java.io.File testClassesDirectory)
public java.io.File getClassesDirectory()
useSystemClassLoader is ignored and the IsolatedClassLoader is
used instead. See the resolution of ClassLoaderConfiguration.public void setClassesDirectory(java.io.File classesDirectory)
public void setDefaultClassesDirectory(java.io.File defaultClassesDirectory)
public java.io.File getReportsDirectory()
public void setReportsDirectory(java.io.File reportsDirectory)
public java.lang.String getTest()
public void setTest(java.lang.String test)
public java.io.File getSummaryFile()
public void setSummaryFile(java.io.File summaryFile)
public boolean isPrintSummary()
public void setPrintSummary(boolean printSummary)
public java.lang.String getReportFormat()
public void setReportFormat(java.lang.String reportFormat)
public boolean isUseFile()
public void setUseFile(boolean useFile)
public java.lang.String getDebugForkedProcess()
public void setDebugForkedProcess(java.lang.String debugForkedProcess)
public int getForkedProcessTimeoutInSeconds()
public void setForkedProcessTimeoutInSeconds(int forkedProcessTimeoutInSeconds)
public int getForkedProcessExitTimeoutInSeconds()
public void setForkedProcessExitTimeoutInSeconds(int forkedProcessExitTimeoutInSeconds)
public double getParallelTestsTimeoutInSeconds()
public void setParallelTestsTimeoutInSeconds(double parallelTestsTimeoutInSeconds)
public double getParallelTestsTimeoutForcedInSeconds()
public void setParallelTestsTimeoutForcedInSeconds(double parallelTestsTimeoutForcedInSeconds)
public boolean isUseSystemClassLoader()
public void setUseSystemClassLoader(boolean useSystemClassLoader)
public boolean isUseManifestOnlyJar()
public void setUseManifestOnlyJar(boolean useManifestOnlyJar)
public java.lang.String getEncoding()
public void setEncoding(java.lang.String encoding)
public boolean isTestFailureIgnore()
public void setTestFailureIgnore(boolean testFailureIgnore)
protected void addPluginSpecificChecksumItems(ChecksumCalculator checksum)
addPluginSpecificChecksumItems in class AbstractSurefireMojopublic java.lang.Boolean getFailIfNoSpecifiedTests()
public void setFailIfNoSpecifiedTests(boolean failIfNoSpecifiedTests)
public int getSkipAfterFailureCount()
public java.lang.String getShutdown()
public java.util.List<java.lang.String> getIncludes()
getIncludes in interface SurefireExecutionParametersgetIncludes in class AbstractSurefireMojopublic void setIncludes(java.util.List<java.lang.String> includes)
setIncludes in interface SurefireExecutionParameterssetIncludes in class AbstractSurefireMojopublic java.io.File[] getSuiteXmlFiles()
getSuiteXmlFiles in class AbstractSurefireMojopublic void setSuiteXmlFiles(java.io.File[] suiteXmlFiles)
setSuiteXmlFiles in class AbstractSurefireMojopublic java.lang.String getRunOrder()
getRunOrder in class AbstractSurefireMojopublic void setRunOrder(java.lang.String runOrder)
setRunOrder in class AbstractSurefireMojopublic java.io.File getIncludesFile()
getIncludesFile in class AbstractSurefireMojopublic java.io.File getExcludesFile()
getExcludesFile in class AbstractSurefireMojoprotected final java.util.List<java.io.File> suiteXmlFiles()
AbstractSurefireMojoAbstractSurefireMojo.getSuiteXmlFiles() as list.
Never returns null.suiteXmlFiles in class AbstractSurefireMojoprotected final boolean hasSuiteXmlFiles()
hasSuiteXmlFiles in class AbstractSurefireMojotrue if suite-xml files array is not empty.static java.nio.charset.Charset toCharset(java.lang.String encoding)