org.apache.maven.plugin.failsafe
Class IntegrationTestMojo

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by org.apache.maven.plugin.surefire.AbstractSurefireMojo
          extended by org.apache.maven.plugin.failsafe.IntegrationTestMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo, SurefireExecutionParameters

@Mojo(name="integration-test",
      requiresProject=true,
      requiresDependencyResolution=TEST,
      defaultPhase=INTEGRATION_TEST,
      threadSafe=true)
public class IntegrationTestMojo
extends AbstractSurefireMojo

Run integration tests using Surefire.

Author:
Jason van Zyl, Stephen Connolly

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.maven.plugin.surefire.AbstractSurefireMojo
AbstractSurefireMojo.DynamicProviderInfo
 
Field Summary
protected  int rerunFailingTestsCount
          (JUnit 4+ providers) The number of times each failing test will be rerun.
protected  String runOrder
          Defines the order the tests will be run in.
 
Fields inherited from class org.apache.maven.plugin.surefire.AbstractSurefireMojo
argLine, artifactFactory, artifactResolver, basedir, childDelegation, classesDirectory, disableXmlReport, enableAssertions, environmentVariables, excludedGroups, excludes, excludesFile, failIfNoTests, FORK_NUMBER_PLACEHOLDER, forkMode, groups, includesFile, junitArtifactName, jvm, localRepository, metadataSource, objectFactory, parallel, parallelMavenExecution, parallelOptimized, perCoreThreadCount, pluginArtifactMap, pluginDescriptor, project, projectArtifactMap, properties, redirectTestOutputToFile, remoteRepositories, reportNameSuffix, session, skip, skipExec, skipTests, systemProperties, systemPropertiesFile, systemPropertyVariables, testClassesDirectory, testNGArtifactName, testSourceDirectory, THREAD_NUMBER_PLACEHOLDER, threadCount, threadCountClasses, threadCountMethods, threadCountSuites, toolchainManager, trimStackTrace, useUnlimitedThreads, workingDirectory
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
IntegrationTestMojo()
           
 
Method Summary
protected  void addPluginSpecificChecksumItems(ChecksumCalculator checksum)
           
 File getBasedir()
           
 File getClassesDirectory()
           
 String getDebugForkedProcess()
           
protected  String[] getDefaultIncludes()
           
 Boolean getFailIfNoSpecifiedTests()
           
 int getForkedProcessTimeoutInSeconds()
           
 List<String> getIncludes()
           
 double getParallelTestsTimeoutForcedInSeconds()
           
 double getParallelTestsTimeoutInSeconds()
           
protected  String getPluginName()
           
 String getReportFormat()
           
 File getReportsDirectory()
           
protected  int getRerunFailingTestsCount()
           
 String getRunOrder()
           
 File[] getSuiteXmlFiles()
           
 File getSummaryFile()
           
 String getTest()
           
 File getTestClassesDirectory()
           
 String getTestMethod()
           
protected  void handleSummary(RunResult summary, Exception firstForkException)
           
 boolean isPrintSummary()
           
 boolean isSkip()
           
 boolean isSkipExec()
          Deprecated. 
protected  boolean isSkipExecution()
           
 boolean isSkipITs()
           
 boolean isSkipTests()
           
 boolean isTestFailureIgnore()
           
 boolean isUseFile()
           
 boolean isUseManifestOnlyJar()
           
 boolean isUseSystemClassLoader()
           
 void setBasedir(File basedir)
           
 void setClassesDirectory(File classesDirectory)
           
 void setDebugForkedProcess(String debugForkedProcess)
           
 void setFailIfNoSpecifiedTests(Boolean failIfNoSpecifiedTests)
           
 void setForkedProcessTimeoutInSeconds(int forkedProcessTimeoutInSeconds)
           
 void setIncludes(List<String> includes)
           
 void setParallelTestsTimeoutForcedInSeconds(double parallelTestsTimeoutForcedInSeconds)
           
 void setParallelTestsTimeoutInSeconds(double parallelTestsTimeoutInSeconds)
           
 void setPrintSummary(boolean printSummary)
           
 void setReportFormat(String reportFormat)
           
 void setReportsDirectory(File reportsDirectory)
           
 void setRunOrder(String runOrder)
           
 void setSkip(boolean skip)
           
 void setSkipExec(boolean skipExec)
          Deprecated. 
 void setSkipITs(boolean skipITs)
           
 void setSkipTests(boolean skipTests)
           
 void setSuiteXmlFiles(File[] suiteXmlFiles)
           
 void setSummaryFile(File summaryFile)
           
 void setTest(String test)
           
 void setTestClassesDirectory(File testClassesDirectory)
           
 void setTestFailureIgnore(boolean testFailureIgnore)
           
 void setUseFile(boolean useFile)
           
 void setUseManifestOnlyJar(boolean useManifestOnlyJar)
           
 void setUseSystemClassLoader(boolean useSystemClassLoader)
           
 
Methods inherited from class org.apache.maven.plugin.surefire.AbstractSurefireMojo
cleanupForkConfiguration, convertWithCoreCount, createCopyAndReplaceForkNumPlaceholder, createForkStarter, createInprocessStarter, createProviders, effectiveIsEnableAssertions, execute, executeAfterPreconditionsChecked, getAdditionalClasspathElements, getArgLine, getArtifactFactory, getArtifactResolver, getClassLoaderConfiguration, getClasspathDependencyExcludes, getClasspathDependencyScopeExclude, getDependenciesToScan, getEffectiveForkCount, getEnvironmentVariables, getExcludedGroups, getExcludes, getExcludesFile, getFailIfNoTests, getForkConfiguration, getForkCount, getForkMode, getGroups, getIncludesFile, getJunitArtifactName, getJvm, getLocalRepository, getMetadataSource, getObjectFactory, getParallel, getPerCoreThreadCount, getPluginArtifactMap, getPluginDescriptor, getProject, getProjectArtifactMap, getProperties, getRemoteRepositories, getReportNameSuffix, getSession, getStatisticsFileName, getSystemProperties, getSystemPropertiesFile, getSystemPropertyVariables, getTestNGArtifactName, getTestSourceDirectory, getThreadCount, getThreadCountClasses, getThreadCountMethods, getThreadCountSuites, getToolchainManager, getUseUnlimitedThreads, getWorkingDirectory, hasExecutedBefore, isAnyConcurrencySelected, isAnyGroupsSelected, isChildDelegation, isDisableXmlReport, isEnableAssertions, isMavenParallel, isParallelOptimized, isRedirectTestOutputToFile, isReuseForks, isTrimStackTrace, 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
 
Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rerunFailingTestsCount

@Parameter(property="failsafe.rerunFailingTestsCount",
           defaultValue="0")
protected int rerunFailingTestsCount
(JUnit 4+ providers) 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.


runOrder

@Parameter(property="failsafe.runOrder",
           defaultValue="filesystem")
protected String runOrder
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 config settings you will re-run once before new statistics data can be established.

Since:
2.7
Constructor Detail

IntegrationTestMojo

public IntegrationTestMojo()
Method Detail

getRerunFailingTestsCount

protected int getRerunFailingTestsCount()
Specified by:
getRerunFailingTestsCount in class AbstractSurefireMojo

handleSummary

protected void handleSummary(RunResult summary,
                             Exception firstForkException)
                      throws org.apache.maven.plugin.MojoExecutionException,
                             org.apache.maven.plugin.MojoFailureException
Specified by:
handleSummary in class AbstractSurefireMojo
Throws:
org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoFailureException

isSkipExecution

protected boolean isSkipExecution()
Specified by:
isSkipExecution in class AbstractSurefireMojo

getPluginName

protected String getPluginName()
Specified by:
getPluginName in class AbstractSurefireMojo

getDefaultIncludes

protected String[] getDefaultIncludes()
Specified by:
getDefaultIncludes in class AbstractSurefireMojo

isSkipTests

public boolean isSkipTests()

setSkipTests

public void setSkipTests(boolean skipTests)

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 File getBasedir()

setBasedir

public void setBasedir(File basedir)

getTestClassesDirectory

public File getTestClassesDirectory()

setTestClassesDirectory

public void setTestClassesDirectory(File testClassesDirectory)

getClassesDirectory

public File getClassesDirectory()

setClassesDirectory

public void setClassesDirectory(File classesDirectory)

getReportsDirectory

public File getReportsDirectory()

setReportsDirectory

public void setReportsDirectory(File reportsDirectory)

getTest

public String getTest()

setTest

public void setTest(String test)

getTestMethod

public String getTestMethod()
Since:
2.7.3

getSummaryFile

public File getSummaryFile()

setSummaryFile

public void setSummaryFile(File summaryFile)

isPrintSummary

public boolean isPrintSummary()

setPrintSummary

public void setPrintSummary(boolean printSummary)

getReportFormat

public String getReportFormat()

setReportFormat

public void setReportFormat(String reportFormat)

isUseFile

public boolean isUseFile()

setUseFile

public void setUseFile(boolean useFile)

getDebugForkedProcess

public String getDebugForkedProcess()

setDebugForkedProcess

public void setDebugForkedProcess(String debugForkedProcess)

getForkedProcessTimeoutInSeconds

public int getForkedProcessTimeoutInSeconds()

setForkedProcessTimeoutInSeconds

public void setForkedProcessTimeoutInSeconds(int forkedProcessTimeoutInSeconds)

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)

isTestFailureIgnore

public boolean isTestFailureIgnore()

setTestFailureIgnore

public void setTestFailureIgnore(boolean testFailureIgnore)

addPluginSpecificChecksumItems

protected void addPluginSpecificChecksumItems(ChecksumCalculator checksum)
Overrides:
addPluginSpecificChecksumItems in class AbstractSurefireMojo

getFailIfNoSpecifiedTests

public Boolean getFailIfNoSpecifiedTests()

setFailIfNoSpecifiedTests

public void setFailIfNoSpecifiedTests(Boolean failIfNoSpecifiedTests)

getIncludes

public List<String> getIncludes()
Specified by:
getIncludes in interface SurefireExecutionParameters
Specified by:
getIncludes in class AbstractSurefireMojo

setIncludes

public void setIncludes(List<String> includes)
Specified by:
setIncludes in interface SurefireExecutionParameters
Specified by:
setIncludes in class AbstractSurefireMojo

getSuiteXmlFiles

public File[] getSuiteXmlFiles()
Specified by:
getSuiteXmlFiles in class AbstractSurefireMojo

setSuiteXmlFiles

public void setSuiteXmlFiles(File[] suiteXmlFiles)
Specified by:
setSuiteXmlFiles in class AbstractSurefireMojo

getRunOrder

public String getRunOrder()
Specified by:
getRunOrder in class AbstractSurefireMojo

setRunOrder

public void setRunOrder(String runOrder)
Specified by:
setRunOrder in class AbstractSurefireMojo


Copyright © 2004–2014 The Apache Software Foundation. All rights reserved.