@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.lang.String |
encoding
The character encoding scheme to be applied.
|
private java.io.File |
excludesFile
A file containing exclude patterns.
|
private java.lang.Boolean |
failIfNoSpecifiedTests
Set this to "true" to cause a failure if the none of the tests specified in -Dtest=...
|
private static java.lang.String |
FAILSAFE_IN_PROGRESS_CONTEXT_KEY |
private int |
forkedProcessTimeoutInSeconds
Kill the forked test process after a certain number of seconds.
|
private java.util.List<java.lang.String> |
includes
A list of <include> elements specifying the tests (by pattern) that should be included in testing.
|
private java.io.File |
includesFile
A file containing include patterns.
|
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
Specify this parameter to run individual tests by file name, overriding the
includes/excludes
parameters. |
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() |
private java.lang.String |
getEncodingOrDefault() |
java.io.File |
getExcludesFile() |
java.lang.Boolean |
getFailIfNoSpecifiedTests() |
int |
getForkedProcessTimeoutInSeconds() |
java.util.List<java.lang.String> |
getIncludes() |
java.io.File |
getIncludesFile() |
double |
getParallelTestsTimeoutForcedInSeconds() |
double |
getParallelTestsTimeoutInSeconds() |
protected java.lang.String |
getPluginName() |
java.lang.String |
getReportFormat() |
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() |
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 |
setFailIfNoSpecifiedTests(boolean failIfNoSpecifiedTests) |
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 . |
cleanupForkConfiguration, convertWithCoreCount, createCopyAndReplaceForkNumPlaceholder, createProviders, effectiveIsEnableAssertions, execute, getAdditionalClasspathElements, getArgLine, getArtifactFactory, getArtifactResolver, getClassLoaderConfiguration, getClasspathDependencyExcludes, getClasspathDependencyScopeExclude, getDependenciesToScan, getEffectiveForkCount, getEnvironmentVariables, getExcludedGroups, getExcludes, getFailIfNoTests, getForkConfiguration, getForkCount, getForkMode, getGroups, getJunitArtifactName, getJvm, getLocalRepository, getMetadataSource, getObjectFactory, getParallel, getPerCoreThreadCount, getPluginArtifactMap, getPluginDescriptor, getProject, getProjectArtifactMap, getRemoteRepositories, getReportNameSuffix, getSession, getSpecificTests, getStatisticsFileName, getSystemProperties, getSystemPropertiesFile, getSystemPropertyVariables, 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, setLocalRepository, setMetadataSource, setObjectFactory, setParallel, setParallelOptimized, setPerCoreThreadCount, setPluginArtifactMap, setProject, setProjectArtifactMap, setProperties, setRedirectTestOutputToFile, setRemoteRepositories, setReportNameSuffix, setSession, setSystemProperties, setSystemPropertiesFile, setSystemPropertyVariables, setTestNGArtifactName, setTestSourceDirectory, setThreadCount, setThreadCountClasses, setThreadCountMethods, setThreadCountSuites, setToolchainManager, setTrimStackTrace, setUseUnlimitedThreads, setWorkingDirectory, showToLog
private static final java.lang.String FAILSAFE_IN_PROGRESS_CONTEXT_KEY
@Parameter(defaultValue="${project.build.outputDirectory}") private java.io.File classesDirectory
@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
includes/excludes
parameters. Each pattern you specify here will be used to create an include pattern formatted like
**/${test}.java
, so you can just type "-Dit.test=MyTest" to run a single test called
"foo/MyTest.java".includes/excludes
parameters, and the TestNG suiteXmlFiles
parameter.
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=MyTest#myMethod" supported for junit 4.x and testNg
@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.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
test
parameter is not specified, the default includes will be
<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.suiteXmlFiles
parameter is specified.testClassesDirectory
which defaults
to the POM property ${project.build.testOutputDirectory}
, typically src/test/java
unless overridden.@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/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
@Parameter(property="failsafe.includesFile") private java.io.File includesFile
includes
are
also specified, these patterns are appended. Example with path, simple and regex includes:@Parameter(property="failsafe.excludesFile") private java.io.File excludesFile
excludes
are
also specified, these patterns are appended. Example with path, simple and regex excludes:@Parameter(property="failsafe.skipAfterFailureCount", defaultValue="0") private int skipAfterFailureCount
@Parameter(property="failsafe.shutdown", defaultValue="testset") private java.lang.String shutdown
protected int getRerunFailingTestsCount()
getRerunFailingTestsCount
in class AbstractSurefireMojo
protected void handleSummary(RunResult summary, java.lang.Exception firstForkException) throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
handleSummary
in class AbstractSurefireMojo
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException
private java.lang.String getEncodingOrDefault()
protected boolean isSkipExecution()
isSkipExecution
in class AbstractSurefireMojo
protected java.lang.String getPluginName()
getPluginName
in class AbstractSurefireMojo
protected java.lang.String[] getDefaultIncludes()
getDefaultIncludes
in class AbstractSurefireMojo
public 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 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 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 boolean isTestFailureIgnore()
public void setTestFailureIgnore(boolean testFailureIgnore)
protected void addPluginSpecificChecksumItems(ChecksumCalculator checksum)
addPluginSpecificChecksumItems
in class AbstractSurefireMojo
public 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 SurefireExecutionParameters
getIncludes
in class AbstractSurefireMojo
public void setIncludes(java.util.List<java.lang.String> includes)
setIncludes
in interface SurefireExecutionParameters
setIncludes
in class AbstractSurefireMojo
public java.io.File[] getSuiteXmlFiles()
getSuiteXmlFiles
in class AbstractSurefireMojo
public void setSuiteXmlFiles(java.io.File[] suiteXmlFiles)
setSuiteXmlFiles
in class AbstractSurefireMojo
public java.lang.String getRunOrder()
getRunOrder
in class AbstractSurefireMojo
public void setRunOrder(java.lang.String runOrder)
setRunOrder
in class AbstractSurefireMojo
public java.io.File getIncludesFile()
getIncludesFile
in class AbstractSurefireMojo
public java.io.File getExcludesFile()
getExcludesFile
in class AbstractSurefireMojo
protected final java.util.List<java.io.File> suiteXmlFiles()
AbstractSurefireMojo
AbstractSurefireMojo.getSuiteXmlFiles()
as list
.
Never returns null.suiteXmlFiles
in class AbstractSurefireMojo
protected final boolean hasSuiteXmlFiles()
hasSuiteXmlFiles
in class AbstractSurefireMojo
suite-xml files array
is not empty.