org.apache.maven.plugin.surefire
Class SurefirePlugin
java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.apache.maven.plugin.surefire.AbstractSurefireMojo
org.apache.maven.plugin.surefire.SurefirePlugin
- All Implemented Interfaces:
- org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo, SurefireExecutionParameters, SurefireReportParameters
@Mojo(name="test",
defaultPhase=TEST,
threadSafe=true,
requiresDependencyResolution=TEST)
public class SurefirePlugin- extends AbstractSurefireMojo
- implements SurefireReportParameters
Run tests using Surefire.
- Author:
- Jason van Zyl
|
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 |
| Methods inherited from class org.apache.maven.plugin.surefire.AbstractSurefireMojo |
addPluginSpecificChecksumItems, 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 |
rerunFailingTestsCount
@Parameter(property="surefire.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="surefire.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
SurefirePlugin
public SurefirePlugin()
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()
- Specified by:
isSkipTests in interface SurefireExecutionParameters- Specified by:
isSkipTests in interface SurefireReportParameters
setSkipTests
public void setSkipTests(boolean skipTests)
- Specified by:
setSkipTests in interface SurefireExecutionParameters- Specified by:
setSkipTests in interface SurefireReportParameters
isSkipExec
public boolean isSkipExec()
- Specified by:
isSkipExec in interface SurefireExecutionParameters- Specified by:
isSkipExec in interface SurefireReportParameters
setSkipExec
public void setSkipExec(boolean skipExec)
- Specified by:
setSkipExec in interface SurefireExecutionParameters- Specified by:
setSkipExec in interface SurefireReportParameters
isSkip
public boolean isSkip()
- Specified by:
isSkip in interface SurefireExecutionParameters- Specified by:
isSkip in interface SurefireReportParameters
setSkip
public void setSkip(boolean skip)
- Specified by:
setSkip in interface SurefireExecutionParameters- Specified by:
setSkip in interface SurefireReportParameters
isTestFailureIgnore
public boolean isTestFailureIgnore()
- Specified by:
isTestFailureIgnore in interface SurefireReportParameters
setTestFailureIgnore
public void setTestFailureIgnore(boolean testFailureIgnore)
- Specified by:
setTestFailureIgnore in interface SurefireReportParameters
getBasedir
public File getBasedir()
- Specified by:
getBasedir in interface SurefireExecutionParameters- Specified by:
getBasedir in interface SurefireReportParameters
setBasedir
public void setBasedir(File basedir)
- Specified by:
setBasedir in interface SurefireExecutionParameters- Specified by:
setBasedir in interface SurefireReportParameters
getTestClassesDirectory
public File getTestClassesDirectory()
- Specified by:
getTestClassesDirectory in interface SurefireExecutionParameters- Specified by:
getTestClassesDirectory in interface SurefireReportParameters
setTestClassesDirectory
public void setTestClassesDirectory(File testClassesDirectory)
- Specified by:
setTestClassesDirectory in interface SurefireExecutionParameters- Specified by:
setTestClassesDirectory in interface SurefireReportParameters
getClassesDirectory
public File getClassesDirectory()
- Specified by:
getClassesDirectory in interface SurefireExecutionParameters
setClassesDirectory
public void setClassesDirectory(File classesDirectory)
- Specified by:
setClassesDirectory in interface SurefireExecutionParameters
getReportsDirectory
public File getReportsDirectory()
- Specified by:
getReportsDirectory in interface SurefireExecutionParameters- Specified by:
getReportsDirectory in interface SurefireReportParameters
setReportsDirectory
public void setReportsDirectory(File reportsDirectory)
- Specified by:
setReportsDirectory in interface SurefireExecutionParameters- Specified by:
setReportsDirectory in interface SurefireReportParameters
getTest
public String getTest()
- Specified by:
getTest in interface SurefireExecutionParameters
getTestMethod
public String getTestMethod()
- Specified by:
getTestMethod in interface SurefireExecutionParameters
- Since:
- 2.7.3
isUseSystemClassLoader
public boolean isUseSystemClassLoader()
- Specified by:
isUseSystemClassLoader in interface SurefireExecutionParameters
setUseSystemClassLoader
public void setUseSystemClassLoader(boolean useSystemClassLoader)
- Specified by:
setUseSystemClassLoader in interface SurefireExecutionParameters
isUseManifestOnlyJar
public boolean isUseManifestOnlyJar()
- Specified by:
isUseManifestOnlyJar in interface SurefireExecutionParameters
setUseManifestOnlyJar
public void setUseManifestOnlyJar(boolean useManifestOnlyJar)
- Specified by:
setUseManifestOnlyJar in interface SurefireExecutionParameters
getFailIfNoSpecifiedTests
public Boolean getFailIfNoSpecifiedTests()
- Specified by:
getFailIfNoSpecifiedTests in interface SurefireExecutionParameters
setFailIfNoSpecifiedTests
public void setFailIfNoSpecifiedTests(Boolean failIfNoSpecifiedTests)
- Specified by:
setFailIfNoSpecifiedTests in interface SurefireExecutionParameters
isPrintSummary
public boolean isPrintSummary()
- Specified by:
isPrintSummary in interface SurefireExecutionParameters
setPrintSummary
public void setPrintSummary(boolean printSummary)
- Specified by:
setPrintSummary in interface SurefireExecutionParameters
getReportFormat
public String getReportFormat()
- Specified by:
getReportFormat in interface SurefireExecutionParameters
setReportFormat
public void setReportFormat(String reportFormat)
- Specified by:
setReportFormat in interface SurefireExecutionParameters
isUseFile
public boolean isUseFile()
- Specified by:
isUseFile in interface SurefireExecutionParameters
setUseFile
public void setUseFile(boolean useFile)
- Specified by:
setUseFile in interface SurefireExecutionParameters
getDebugForkedProcess
public String getDebugForkedProcess()
- Specified by:
getDebugForkedProcess in interface SurefireExecutionParameters
setDebugForkedProcess
public void setDebugForkedProcess(String debugForkedProcess)
- Specified by:
setDebugForkedProcess in interface SurefireExecutionParameters
getForkedProcessTimeoutInSeconds
public int getForkedProcessTimeoutInSeconds()
- Specified by:
getForkedProcessTimeoutInSeconds in interface SurefireExecutionParameters
setForkedProcessTimeoutInSeconds
public void setForkedProcessTimeoutInSeconds(int forkedProcessTimeoutInSeconds)
- Specified by:
setForkedProcessTimeoutInSeconds in interface SurefireExecutionParameters
getParallelTestsTimeoutInSeconds
public double getParallelTestsTimeoutInSeconds()
- Specified by:
getParallelTestsTimeoutInSeconds in interface SurefireExecutionParameters
setParallelTestsTimeoutInSeconds
public void setParallelTestsTimeoutInSeconds(double parallelTestsTimeoutInSeconds)
- Specified by:
setParallelTestsTimeoutInSeconds in interface SurefireExecutionParameters
getParallelTestsTimeoutForcedInSeconds
public double getParallelTestsTimeoutForcedInSeconds()
- Specified by:
getParallelTestsTimeoutForcedInSeconds in interface SurefireExecutionParameters
setParallelTestsTimeoutForcedInSeconds
public void setParallelTestsTimeoutForcedInSeconds(double parallelTestsTimeoutForcedInSeconds)
- Specified by:
setParallelTestsTimeoutForcedInSeconds in interface SurefireExecutionParameters
setTest
public void setTest(String test)
- Specified by:
setTest in interface SurefireExecutionParameters
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.